title: Log4j Filepattern not working when SizeBasedTriggeringPolicy triggered
body: <p>We're having issues with our log4j2 configuration, which we've taken almost directly from <a href="https://www.baeldung.com/java-logging-rolling-file-appenders" rel="nofollow noreferrer">https://www.baeldung.com/java-logging-rolling-file-appenders</a> section 4.4:</p>
  
  <pre><code>&lt;RollingFile name="roll-by-time-and-size"
    fileName="target/log4j2/roll-by-time-and-size/app.log"
    filePattern="target/log4j2/roll-by-time-and-size/app.%d{MM-dd-yyyy-HH-mm-ss.SSS}.%i.log.gz"
    ignoreExceptions="false"&gt;
      &lt;PatternLayout&gt;
          &lt;Pattern&gt;%d{yyyy-MM-dd HH:mm:ss} %p %m%n&lt;/Pattern&gt;
      &lt;/PatternLayout&gt;
      &lt;Policies&gt;
          &lt;SizeBasedTriggeringPolicy size="5 KB" /&gt;
          &lt;TimeBasedTriggeringPolicy interval="5000000" /&gt;
      &lt;/Policies&gt;
      &lt;DefaultRolloverStrategy&gt;
          &lt;Delete basePath="." maxDepth="2"&gt;
              &lt;IfFileName glob="target/log4j2/roll-by-time-and-size/app.*.log.gz" /&gt;
              &lt;IfLastModified age="20d" /&gt;
          &lt;/Delete&gt;
      &lt;/DefaultRolloverStrategy&gt;
  &lt;/RollingFile&gt;
  </code></pre>
  
  <p>If I reduce the interval to ensure it's rolling based on time, this puts the correct current time in the file name.  But if I increase the interval to 5000 or whatever and let the SizeBasedTriggeringPolicy get hit, the timestamp is always the same and the only thing that changes in the index at the end of the file.</p>
  
  <p>This is a problem for us because we have a cron job going and moving rolled-over files to a remote mount point.  This means the next time log4j hits the size based triggering policy, the index will be reset to 1 the timestamp in the filename will be the same even though it shouldn't be (why??), and our cron job will try to move the file but it will be the same filename as another file it already moved.</p>
  
  <p>Using the latest spring boot starter log4j2 (as of now) </p>
  
  <p>Is the a bug or intended behavior.  It doesn't make much sense as an intended behavior, but if so, what should we do to solve this?</p>