I created a command line tool that ships as an executable jar. When someone uses my tool I do not know where the jar will be located. All of the logging is being done with logback. I want my log file to go to the same directory as the jar file no matter where the jar is located and no matter what the current directory is.
My current logback.xml files looks like this.
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>admintool.log</file>
<encoder>
<charset>UTF-8</charset>
<pattern>%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"} [%thread] %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
</root>
</configuration>
Does anyone know how I can get the log to go where the jar is? Thanks in advance.