How to get the log location from spring application code. I am implementing the logging functionality for Spring web service using logback-classic. In the logback.xml, i need to mention the location where my custom log file has to be created. I used below snippet as appender in logback.xml.
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logroot}/wsp-bloa.log</file>
<encoder>
<pattern>%d{ISO8601}|%t|%p|%c{1}|%m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${logger.level}</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${logroot}/wsp-bloa%i.log.gz</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>5</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>5MB</maxFileSize>
</triggeringPolicy>
</appender>
Please let me know if we have any other option to get SERVER_LOG_ROOT other than having adding JVM variable in custom properties to mimic the environment SERVER_LOG_ROOT something like this key: logroot, value: ${SERVER_LOG_ROOT}