I would like to put log file into user home directory.
How to do that in portable way, i.e. working on Windows, Linux and Mac?
According to Logback documentation, you should use ${user.home}
, which is an environment variable present in the JVM directly coming from the OS (so it is portable):
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${user.home}/logback.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>