You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Tapan Ray (Jira)" <ji...@apache.org> on 2020/12/27 08:54:00 UTC

[jira] [Updated] (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 ]

Tapan Ray updated LOG4J2-2983:
------------------------------
    Summary: evaluateOnStartUp with CronTriggeringPolicy file renaming behavior at midnight on service restart  (was: evaluateOnStartUp with CronTriggeringPolicy file renaming behavior at midnight)

> 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 "catalina_20200101.log", and create new "catalina.log".
> At midnight, "catalina.log" got correctly renamed "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 stmpa.
>  
> Please look into it.
>  
> Here's my configure xml.
>  
> <?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.out.*" />
>  <IfLastModified age="15d" />
>  </Delete>
>  </DefaultRolloverStrategy>
>  </RollingFile>
>  </Appenders>
>  <Loggers>
>  <Root level="info">
>  <AppenderRef ref="DailyRollingFile"/>
>  </Root>
>  </Loggers>
> </Configuration>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)