title: Logback sift RollingFileAppender not rotating when run from WAR
body: <p>I have a logback config that logs to multiple files including the primary log file called servernexus.log.  Each log file is suppose to be rotated by RollingFileAppender.  When I run from eclipse with the logback config file and everything else in my $CLASSPATH the servernexus.log is rotated properly by logback.  When I run from my production WAR file logging works but the servernexus.log rotation never happens.</p>
  <p>Here's the logback-server-win32event.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;configuration&gt;
      &lt;appender name=&quot;SiftAppender&quot; class=&quot;ch.qos.logback.classic.sift.SiftingAppender&quot;&gt;
          &lt;discriminator&gt;
              &lt;key&gt;discriminatorId&lt;/key&gt;
              &lt;defaultValue&gt;${cmb.log.file.name}&lt;/defaultValue&gt;
          &lt;/discriminator&gt;
          &lt;sift&gt;
              &lt;appender name=&quot;FILE-${discriminatorId}&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
                  &lt;file&gt;${cmb.log.dir}/${discriminatorId}.log&lt;/file&gt;
                  &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.TimeBasedRollingPolicy&quot;&gt;
                      &lt;!-- daily rollover --&gt;
                      &lt;fileNamePattern&gt;${cmb.log.dir}/archive/${discriminatorId}.%d{yyyy-MM-dd}.log.gz&lt;/fileNamePattern&gt;
                      &lt;!-- keep ${maxbackupindex} days' worth of history capped at ${maxfilesize} total size --&gt;
                      &lt;maxHistory&gt;${cmb.log.maxbackupindex}&lt;/maxHistory&gt;
                      &lt;totalSizeCap&gt;${cmb.log.maxfilesize}&lt;/totalSizeCap&gt;
                  &lt;/rollingPolicy&gt;
                  &lt;encoder&gt;
                      &lt;pattern&gt;%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %msg%n&lt;/pattern&gt;
                  &lt;/encoder&gt;
              &lt;/appender&gt;
          &lt;/sift&gt;
      &lt;/appender&gt;
  
      &lt;logger name=&quot;org.apache&quot; level=&quot;WARN&quot;/&gt;
      &lt;logger name=&quot;org.hibernate&quot; level=&quot;INFO&quot;/&gt;
      &lt;logger name=&quot;org.hibernate.type&quot; level=&quot;ERROR&quot;/&gt;
      &lt;logger name=&quot;org.hibernate.id&quot; level=&quot;ERROR&quot;/&gt;
      &lt;logger name=&quot;org.hibernate.cfg.annotations&quot; level=&quot;WARN&quot;/&gt;
      &lt;logger name=&quot;org.hibernate.tool.hbm2ddl&quot; level=&quot;WARN&quot;/&gt;
      &lt;!-- DEBUG output shows db user password:  --&gt;
      &lt;logger name=&quot;org.hibernate.jpa.internal.util.LogHelper&quot; level=&quot;WARN&quot;/&gt;
      &lt;!-- DEBUG output shows db user password:  --&gt;
      &lt;logger name=&quot;org.hibernate.internal.util.EntityPrinter&quot; level=&quot;WARN&quot;/&gt;
      &lt;logger name=&quot;com.mchange&quot; level=&quot;INFO&quot;/&gt;
      &lt;logger name=&quot;org.springframework&quot; level=&quot;WARN&quot;/&gt;
      &lt;logger name=&quot;org.quartz&quot; level=&quot;INFO&quot;/&gt;
      &lt;!-- HtmlUnit - turn off debug by debug --&gt;
      &lt;logger name=&quot;com.gargoylesoftware.htmlunit&quot; level=&quot;INFO&quot;/&gt;
      &lt;logger name=&quot;org.eclipse&quot; level=&quot;WARN&quot;/&gt;
      &lt;!-- Disable &quot;WARN XXX scanned from multiple locations&quot; --&gt;
      &lt;logger name=&quot;org.eclipse.jetty.annotations.AnnotationParser&quot; level=&quot;ERROR&quot;/&gt;
      &lt;if condition='isDefined(&quot;logging.jetty.level&quot;)'&gt;
          &lt;then&gt;
              &lt;logger name=&quot;org.eclipse.jetty&quot; level=&quot;${logging.jetty.level}&quot;/&gt;
          &lt;/then&gt;
          &lt;else&gt;
              &lt;logger name=&quot;org.eclipse.jetty&quot; level=&quot;INFO&quot;/&gt;
          &lt;/else&gt;
      &lt;/if&gt;
  
      &lt;root level=&quot;WARN&quot;&gt;
          &lt;appender-ref ref=&quot;SiftAppender&quot; /&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>As you can see I'm using a discriminator which is set as a system property at runtime prior to logback being initialized.  You can see the &quot;cmb.log.file.name&quot; property in the output below.</p>
  <p>When I run from eclipse it works and reports the expected TimeBasedRollingPolicy lines:</p>
  <pre><code>11:19:40,144 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.file = C:\Users\mcooper\ws\cmb\6.0\run\server\log\servernexus.log
  11:19:40,194 INFO  Log Configurator                                   T1  | Configuring log to file for logback var &quot;log.file.name&quot; = &quot;servernexus&quot;
  11:19:40,194 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.file.name = servernexus
  11:19:40,194 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.maxfilesize = 50MB
  11:19:40,194 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.maxbackupindex = 5
  11:19:40,303 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-server-win32event.xml] at [file:/C:/Users/mcooper/ws/cmb/6.0/CmbProduct/Common/bin/main/logback-server-win32event.xml]
  11:19:40,440 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.sift.SiftingAppender]
  11:19:40,455 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SiftAppender]
  11:19:40,478 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.sift.MDCBasedDiscriminator] for [discriminator] property
  11:19:40,493 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.mangogrove.logbackwela.Win32EventLogAppender]
  11:19:40,496 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [EventLogAppender]
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.apache] to WARN
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate] to INFO
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.type] to ERROR
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.id] to ERROR
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.cfg.annotations] to WARN
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.tool.hbm2ddl] to WARN
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.jpa.internal.util.LogHelper] to WARN
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.internal.util.EntityPrinter] to WARN
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.mchange] to INFO
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework] to WARN
  11:19:40,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.quartz] to INFO
  11:19:40,502 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.gargoylesoftware.htmlunit] to INFO
  11:19:40,502 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.eclipse] to WARN
  11:19:40,872 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.eclipse.jetty] to INFO
  11:19:40,872 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
  11:19:40,872 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SiftAppender] to Logger[ROOT]
  11:19:40,873 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EventLogAppender] to Logger[ROOT]
  11:19:40,873 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
  11:19:40,878 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@64485a47 - Registering current configuration as safe fallback point
  2020-09-01 11:19:40.952:INFO::main: Logging initialized @1106ms to org.eclipse.jetty.util.log.StdErrLog
  11:19:40,979 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
  11:19:40,985 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE-servernexus]
  11:19:40,993 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@2076287037 - setting totalSizeCap to 50 MB
  11:19:41,015 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@2076287037 - Will use gz compression
  11:19:41,017 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@2076287037 - Will use the pattern C:/Users/mcooper/ws/cmb/6.0/run/server/log/archive/servernexus.%d{yyyy-MM-dd}.log for the active file
  11:19:41,024 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'C:/Users/mcooper/ws/cmb/6.0/run/server/log/archive/servernexus.%d{yyyy-MM-dd}.log.gz'.
  11:19:41,024 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
  11:19:41,026 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Tue Sep 01 11:17:12 PDT 2020
  11:19:41,028 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
  11:19:41,066 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE-servernexus] - Active log file name: C:\Users\mcooper\ws\cmb\6.0\run\server\log/servernexus.log
  11:19:41,066 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE-servernexus] - File property is set to [C:\Users\mcooper\ws\cmb\6.0\run\server\log/servernexus.log]
  </code></pre>
  <p>When I run from production WAR file the logback output does not report anything for TimeBasedRollingPolicy:</p>
  <pre><code>10:55:10,673 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.dir = C:\ProgramData\XXX\YYY\log
  10:55:10,673 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.file = C:\ProgramData\XXX\YYY\log\servernexus.log
  10:55:10,767 INFO  Log Configurator                                   T1  | Configuring log to file for logback var &quot;log.file.name&quot; = &quot;servernexus&quot;
  10:55:10,767 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.file.name = servernexus
  10:55:10,767 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.maxfilesize = 50MB
  10:55:10,767 INFO  Log Configurator                                   T1  | Logging PROP cmb.log.maxbackupindex = 5
  10:55:10,782 INFO  Log Configurator                                   T1  | Logging [servernexus.log] to C:\ProgramData\XXX\YYY\log\servernexus.log using logback-server-win32event.xml
  2020-09-01 10:55:12.236:INFO::main: Logging initialized @1792ms to org.eclipse.jetty.util.log.StdErrLog
  SLF4J: Class path contains multiple SLF4J bindings.
  SLF4J: Found binding in [jar:file:/C:/Users/s-cmbtest/AppData/Local/Temp/yyy_console_wartmp_6.0.79/webapp/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: Found binding in [jar:file:/C:/Program%20Files/XXX/YYY/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  10:55:59,322 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-server-win32event.xml] at [jar:file:/C:/Users/s-cmbtest/AppData/Local/Temp/yyy_console_wartmp_6.0.79/webapp/WEB-INF/lib/Common-6.0.79.jar!/logback-server-win32event.xml]
  10:55:59,322 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-server-win32event.xml] occurs multiple times on the classpath.
  10:55:59,322 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-server-win32event.xml] occurs at [jar:file:/C:/Users/s-cmbtest/AppData/Local/Temp/yyy_console_wartmp_6.0.79/webapp/WEB-INF/lib/Common-6.0.79.jar!/logback-server-win32event.xml]
  10:55:59,322 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-server-win32event.xml] occurs at [jar:file:/C:/Program%20Files/XXX/YYY/lib/Common-6.0.79.jar!/logback-server-win32event.xml]
  10:55:59,338 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@1f05b63d - URL [jar:file:/C:/Users/s-cmbtest/AppData/Local/Temp/yyy_console_wartmp_6.0.79/webapp/WEB-INF/lib/Common-6.0.79.jar!/logback-server-win32event.xml] is not of type file
  10:55:59,448 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
  10:55:59,448 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.sift.SiftingAppender]
  10:55:59,448 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SiftAppender]
  10:55:59,463 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.sift.MDCBasedDiscriminator] for [discriminator] property
  10:55:59,463 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.mangogrove.logbackwela.Win32EventLogAppender]
  10:55:59,479 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [EventLogAppender]
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.apache] to WARN
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate] to INFO
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.type] to ERROR
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.id] to ERROR
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.cfg.annotations] to WARN
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.tool.hbm2ddl] to WARN
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.jpa.internal.util.LogHelper] to WARN
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.internal.util.EntityPrinter] to WARN
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.mchange] to INFO
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework] to WARN
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.quartz] to INFO
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.gargoylesoftware.htmlunit] to INFO
  10:55:59,479 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.eclipse] to WARN
  10:55:59,775 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.eclipse.jetty] to INFO
  10:55:59,775 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
  10:55:59,775 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SiftAppender] to Logger[ROOT]
  10:55:59,775 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EventLogAppender] to Logger[ROOT]
  10:55:59,775 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
  10:55:59,775 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@524b1c70 - Registering current configuration as safe fallback point
  </code></pre>