[ 
https://issues.apache.org/jira/browse/LOG4J2-820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14129569#comment-14129569
 ] 

Ralph Goers commented on LOG4J2-820:
------------------------------------

There is no "default" rollover interval. You control that by the pattern you 
use in the %d.  

The filePattern you specified above is incorrect. Only a single %d{} is allowed 
in the pattern.  If that pattern includes HH as the finest granularity then the 
file will rollover every hour. If it only has 'dd' then it will rollover every 
day. If it is MM then it will rollover every month.

Your pattern should be "/backup/$${yyyy/MM/dd}/module-%d{yyyy-MM-dd}-%i.log.gz 
if you want to roll over every day. if you want to roll over every hour then 
specify %{yyyy-MM-dd-HH} instead.  Note that the %i is only going to get 
incrementedd if the size of your file grows above 2GB during that interval.

> Default interval unit in TimeBasedTriggeringPolicy
> --------------------------------------------------
>
>                 Key: LOG4J2-820
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-820
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.0.2
>            Reporter: Hassan Kalaldeh
>
> I just found that default interval type if not given in 
> TimeBasedTriggeringPolicy is day not hour while using RollingFileAppender.
> here is appender I use:
> {code}
> <RollingFile name="DailyRollDfm" fileName="/logs/itms2/dfm.log" 
> filePattern="/backup/%d{yyyy}/%d{MM}/%d{dd}/module-%d{yyyy-MM-dd}-%i.log.gz"
>         append="true" immediateFlush="false">
>       <PatternLayout>
>         <Pattern>%d{ISO8601}: %-5p [%-8t] [%C{1}.%M():%L] - %m%n</Pattern>
>       </PatternLayout>
>       <Policies>
>         <SizeBasedTriggeringPolicy size="2 GB" />
>         <TimeBasedTriggeringPolicy interval="24" modulate="true" />
>         <OnStartupTriggeringPolicy />
>       </Policies>
>         <DefaultRolloverStrategy max="100"/>
> </RollingFile>
> {code}
> but the example in 
> http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender 
> assumes default is in hours not in days.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to