How to put log file in user home directory in portable way in logback?
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>