Folks,

I define a number of locally scoped properties in my logback configuration which are reused throughout the remainder of the file. For example:

<property name="LOG_DATE_FORMAT" value="'yyyy-MM-dd HH:mm:ss,SSS Z'" />
<property name="LOG_TIMEZONE" value="" />
<property name="LOG_BASEDIR" value="${catalina.base}/logs/myappname" />

...
...
...

  <appender name="MyAppName-RFA" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${LOG_BASEDIR}/myappname.log</file>

    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>DEBUG</level>
    </filter>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- Monthly Rollover, 24 Month Retention -->
      <fileNamePattern>${LOG_BASEDIR}/archive/%d{yyyy,aux}/myappname.%d{MM}.log.gz</fileNamePattern>
      <maxHistory>24</maxHistory>
    </rollingPolicy>

    <encoder>
      <pattern>%d{${LOG_DATE_FORMAT},${LOG_TIMEZONE}} %-6p [%X{MyAppName-UUID}] %c:%M - %m%n</pattern>
      <outputPatternAsHeader>false</outputPatternAsHeader>
    </encoder>
  </appender>

I have multiple rolling file appenders, so rather than define the values manually for each appender, I define the local property and reuse as appropriate.

However, by default the LOG_TIMEZONE value is empty - I only want this value to be populated when a specific timezone is required. However, as a result of defining this property but specifying no value I get the following error message at startup:

18:30:41,402 |-ERROR in ch.qos.logback.core.joran.action.PropertyAction - In <property> element, either the "file" attribute alone, or the "resource" element alone, or both the "name" and "value" attributes must be set.

I assume from this error message that a property cannot have a NULL/empty value - i.e. this is expected behaviour? I guess I could remove/comment the property if it is not being used in the current configuration - although I'd rather not remove it from the configuration file completely, since its presence also acts as a visual reminder of which properties can be set.

Regards,

Shane