I'm setting up a TimeBasedRollingPolicy
from Log4J Extras and I am not clear what tells the policy when to roll over. The API is not explicit so I'm just making inferences. It sounds like it's the last element in the FileNamePattern
that determines the frequency.
Take this example from the log4j Wiki:
<appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
<!-- The active file to log to -->
<param name="file" value="/applogs/myportal/portal.log" />
<param name="append" value="true" />
<param name="encoding" value="UTF-8" />
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<!-- The file to roll to, this is a fairly intelligent parameter, if the file
ends in .gz, it gzips it, based on the date stamp it rolls at that time,
default is yyyy-MM-dd, (rolls at midnight)
-->
<param name="FileNamePattern" value="/applogs/myportal/portal.%d.log.gz" />
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p %d{ISO8601} [%t][%x] %c - %m%n" />
</layout>
</appender>
Am I to assume that because the pattern ends in dd
, the policy is to roll when that changes? Same with an example in the API, a pattern of yyyy-MM
means the file should roll when MM
changes?
Thanks!
Paul