You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2021/12/05 07:51:00 UTC

[jira] [Resolved] (LOG4J2-2983) evaluateOnStartUp with CronTriggeringPolicy file renaming behavior at midnight on service restart

     [ https://issues.apache.org/jira/browse/LOG4J2-2983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers resolved LOG4J2-2983.
---------------------------------
    Resolution: Cannot Reproduce

> evaluateOnStartUp with CronTriggeringPolicy file renaming behavior at midnight on service restart
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2983
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2983
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.14.0
>            Reporter: Tapan Ray
>            Priority: Critical
>
> Hi.
>  I tried CrontriggeringPolicy(added 2.14.0 version) for rolling daily log files at midnight. I have set evaluateOnStartup="true".
>  My goal is, for example.
>  if today is 2020/01/01, "catalina.log" is my active log file.
>  and at midnight, "catalina.log" should be renamed to "catalina_20200101.log", and create new "catalina.log".
> At midnight, "catalina.log" got correctly renamed to "catalina_20200101.log" and new catalina.log" got created. 
> _*Then I stopped my service and restarted. I found that immediately another file "catalina_20200102.log" with same date got created.*_ 
>  
> It should not have happened as the midnight rollover already happened. On service restart it should not roll over the file again with same date time stamp.
>  
> Please look into it.
>  
> Here's my configure xml.
>  
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
>  <Configuration status="debug">
>  <Properties>
>  <Property name="baseDir">${sys:catalina.base}/logs</Property>
>  </Properties>
>  <Appenders>
>  <RollingFile name="DailyRollingFile" fileName="${baseDir}/catalina.log" filePattern="${baseDir}/catalina_%d{yyyy-MM-dd}.log." append="true">
>  <PatternLayout>
>  <Pattern>%d{MMM dd, yyyy HH:mm:ss a} %c %M %p: %m%n</Pattern>
>  </PatternLayout>
>  <Policies>
>  <CronTriggeringPolicy schedule="0 0 0 * * ?" evaluateOnStartup="true"/>
>  </Policies>
>  <DefaultRolloverStrategy>
>  <Delete basePath="${baseDir}">
>  <IfFileName glob="catalina_*.log" />
>  <IfLastModified age="15d" />
>  </Delete>
>  </DefaultRolloverStrategy>
>  </RollingFile>
>  </Appenders>
>  <Loggers>
>  <Root level="info">
>  <AppenderRef ref="DailyRollingFile"/>
>  </Root>
>  </Loggers>
>  </Configuration>{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)