title: log4j2: TimeBasedTriggeringPolicy is not triggering file roll-over
body: <p>I am using log4j 2.0-rc1, StructuredDataMessage and EventLogger to perform dynamic logging.</p>
  
  <p>Below log4j2.xml configuration meant to:  </p>
  
  <ul>
  <li>rotate log files on hourly basis OR after file reaches 64 MB (whatever comes first)</li>
  <li><p>archive logs that does not satisfy the file pattern</p>
  
  <p>
  
  
      
          
      </p>
  
  <pre><code>&lt;Routing name="Routing"&gt;
      &lt;Routes pattern="$${sd:type}"&gt;
          &lt;Route&gt;
              &lt;RollingFile name="RollingFile-${sd:type}"
                           fileName="${log.path}/${date:yyyyMMdd}/${date:yyyyMMddHH}-${sd:type}-${hostName}.log"
                           filePattern="${log.path}/%d{yyyyMMdd}/%d{yyyyMMddHH}-${sd:type}-${hostName}.%i.log.gz"&gt;
                  &lt;PatternLayout&gt;  
                      &lt;!-- %K{v} stands for the message passed in StructuredDataMessage map with key "v" --&gt;
                      &lt;!-- %n stands for new line --&gt;
                      &lt;Pattern&gt;%K{v}%n&lt;/Pattern&gt;
                  &lt;/PatternLayout&gt;
                  &lt;Policies&gt;
                      &lt;TimeBasedTriggeringPolicy interval="1"/&gt;
                      &lt;SizeBasedTriggeringPolicy size="64 MB"/&gt;
                  &lt;/Policies&gt;
                  &lt;DefaultRolloverStrategy max="999"/&gt;
              &lt;/RollingFile&gt;
          &lt;/Route&gt;
      &lt;/Routes&gt;
  &lt;/Routing&gt;
  </code></pre>
  
  <p></p>
  
  <p>
      
          
      </p>
  
  <pre><code>&lt;Root level="warn"&gt;
      &lt;AppenderRef ref="STDOUT"/&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>
   </p></li>
  </ul>
  
  <p>There are two issues:</p>
  
  <ol>
  <li><p>logging is performed on an "old" log file few minutes after new hour triggers:</p>
  
  <p>Feb 19 20:13 2014021919-planoperator-mdmlocal.mobidia.com.log<br>
  Feb 19 20:13 2014021919-planprogress-mdmlocal.mobidia.com.log<br>
  Feb 19 20:13 2014021919-planstats-mdmlocal.mobidia.com.log<br>
  Feb 19 20:08 2014021919-sim-mdmlocal.mobidia.com.log  </p></li>
  <li><p>whenever JVM is restarted, log4j abandons "old" files un-archived</p>
  
  <p>Feb 19 20:13 2014021919-planstats-mdmlocal.mobidia.com.log<br>
  Feb 19 20:29 2014021920-planstats-mdmlocal.mobidia.com.log  </p></li>
  </ol>