I have defined a variable in web.xml inside a war package like:
<env-entry>
<env-entry-name>LOG_DIR</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>${CATALINA_HOME}</env-entry-value>
</env-entry>
Also I have logback.xml file in classpath. And I want to use this variable there:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/logs/WebStore.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level [%logger{36}] [%thread] %msg%n</pattern>
</encoder>
</appender>
When I start my tomcat instance I get LOG_DIR_IS_UNDEFINED folder in tomcat bin directory.
I know I can create a property file and import it into logback.xml but I do not want to create one more file and I am interested in using variable in this way. Is it possible?