<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<if condition='property("os.name").contains("windows")'>
<then>
<property name="app.dir" value="${env.APPDATA}" />
</then>
</if>
<if condition='${os.name}.contains("mac")'>
<then>
<property name="app.dir" value="${user.home}/Library/Application Support" />
</then>
</if>
<if condition='${os.name}.contains("linux")'>
<then>
<property name="app.dir" value="${user.home}" />
</then>
</if>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${app.dir}/MyApp/logs/app.log</file>
<encoder>
<Pattern>[%d{Y-MM-dd HH:mm:ss}] [%level] %msg%n</Pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="FILE"/>
</root>
</configuration>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>2.6.1</version>
</dependency>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<if condition='property("os.name").toLowerCase().startsWith("windows")'>
<then>
<file>${APPDATA}/MyApp/logs/MyApp.log</file>
</then>
<else>
<if condition='property("os.name").toLowerCase().startsWith("mac")'>
<then>
<file>${user.home}/Library/Application Support/MyApp/logs/MyApp.log</file>
</then>
<else>
<file>${user.home}/.myapp/logs/myapp.log</file>
</else>
</if>
</else>
</if>
<encoder>
<Pattern>[%d{Y-MM-dd HH:mm:ss}] [%level] %msg%n</Pattern>
</encoder>
<prudent>true</prudent>
</appender>
<root level="INFO">
<appender-ref ref="FILE"/>
</root>
</configuration>