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

Edith Chui updated LOG4J2-2669:
-------------------------------
    Description: 
Since version 2.11.2, the log42 library is unable to roll the file by date. It 
will move the previous day's log to an existing log backup file with date 
different to the log date. 

e.g. Assume previous day is 1 Jan, and some logs with log date 1 Jan were 
written in test.log already. Running application on 2 Jan and continue do some 
logging, the previous day log will be moved to 31 Dec and the log on 31 Dec was 
erased. After observed for few more days, the rolling is still incorrect.

Using the same configuration, no such problem was occurred in 2.11.1.

Sample :
{code:java}
<RollingFile name="fileAppender" fileName="C:/temp/test.log" 
filePattern="C:/temp/test_%d{yyyy-MM-dd}.bak">
  <PatternLayout pattern="%d{ISO8601} [%p] [%t] [%C] at [${hostName}] %m\r\n" />
  <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true" />
  </Policies>
  <DefaultRolloverStrategy>
    <Delete basePath="C:/temp/test.log" maxDepth="1">
      <IfLastModified age="10d" />
    </Delete>
  </DefaultRolloverStrategy>
</RollingFile>{code}

  was:
Since version 2.11.2, the log42 library is unable to roll the file by date. It 
will move the previous day's log to an existing log backup file with date 
different to the log date. 

e.g. If previous day is 1 Jan, and some logs with log date 1 Jan were written 
in test.log already. Running application on 2 Jan and continue do some logging, 
the previous day log will be moved to 31 Dec and the log on 31 Dec was erased. 
After observed for few more days, the rolling is still incorrect.

Using the same configuration, no such problem was occurred in 2.11.1.

Sample :
{code:java}
<RollingFile name="fileAppender" fileName="C:/temp/test.log" 
filePattern="C:/temp/test_%d{yyyy-MM-dd}.bak">
  <PatternLayout pattern="%d{ISO8601} [%p] [%t] [%C] at [${hostName}] %m\r\n" />
  <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true" />
  </Policies>
  <DefaultRolloverStrategy>
    <Delete basePath="C:/temp/test.log" maxDepth="1">
      <IfLastModified age="10d" />
    </Delete>
  </DefaultRolloverStrategy>
</RollingFile>{code}


> RollingFileAppender is not rolled by date correctly
> ---------------------------------------------------
>
>                 Key: LOG4J2-2669
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2669
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders, Core
>    Affects Versions: 2.11.2, 2.12.0
>            Reporter: Edith Chui
>            Priority: Major
>         Attachments: log4j2.issue.zip
>
>
> Since version 2.11.2, the log42 library is unable to roll the file by date. 
> It will move the previous day's log to an existing log backup file with date 
> different to the log date. 
> e.g. Assume previous day is 1 Jan, and some logs with log date 1 Jan were 
> written in test.log already. Running application on 2 Jan and continue do 
> some logging, the previous day log will be moved to 31 Dec and the log on 31 
> Dec was erased. After observed for few more days, the rolling is still 
> incorrect.
> Using the same configuration, no such problem was occurred in 2.11.1.
> Sample :
> {code:java}
> <RollingFile name="fileAppender" fileName="C:/temp/test.log" 
> filePattern="C:/temp/test_%d{yyyy-MM-dd}.bak">
>   <PatternLayout pattern="%d{ISO8601} [%p] [%t] [%C] at [${hostName}] %m\r\n" 
> />
>   <Policies>
>     <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>   </Policies>
>   <DefaultRolloverStrategy>
>     <Delete basePath="C:/temp/test.log" maxDepth="1">
>       <IfLastModified age="10d" />
>     </Delete>
>   </DefaultRolloverStrategy>
> </RollingFile>{code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to