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

Hassan Kalaldeh commented on LOG4J2-820:
----------------------------------------

OK I think I got it, I just saw your comment from old ticket LOG4J2-573, you 
wrote:

"The time-based triggering policy requires a time pattern to determine the 
frequency to rollover.
 In your configuration you have an interval of 12.  Is that 12 seconds, 
minutes, hours or
years?  The policy obtains that information by looking at the pattern and using 
the smallest
time unit in it.  Since the policy cannot determine the rollover frequency it 
is appropriate
for it to throw a Log4j exception."

It would be great if this information can be documented somewhere, thanks Ralph 
Goers. 

BTW, does that mean we don't have the choice to change interval unit without 
changing file pattern ? for example I want to have a folder of archived logs 
per day without showing hours (i.e. 
{code}filePattern="logs/$${date:yyyy-MM-dd}/app-%d{yyyy-MM-dd}-%i.log.gz"{code} 
, but during the day I want do the archive every 6 hours (so each folder will 
have four archived files at the end of the day)



> 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