I have following variable in logback-sring.xml and I want to override its default value using value supplied in command line.
<property name="log_root" value="${log.root:-logapp/logs}"/>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_root}/app.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_root}/archived/app.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days worth of history, but at most 1GB -->
<totalSizeCap>1GB</totalSizeCap>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%level %d [%thread] %logger{15} - %msg %ex{2}%nopex%n</pattern>
</encoder>
</appender>
I tried to override the value during the jar call:
java -jar app.jar -Dlog.root=logappv2/logs
But the app always use the default log.root value. What is possibly the cause?
logback-spring.xmlreferringlog_root