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 2019/08/06 04:36:00 UTC

[jira] [Comment Edited] (LOG4J2-2669) RollingFileAppender is not rolled by date correctly

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

Ralph Goers edited comment on LOG4J2-2669 at 8/6/19 4:35 AM:
-------------------------------------------------------------

First, can you try with 2.12.0?  The behavior should be that the date used for the first rollover should be the date the file was created. After that it would be the date when the previous rollover occurred. So if the file is created on Dec 31 and then you shutdown and restart on Jan 1 the date of the first file should be Dec 31. Since the next file was created on Jan 1 that would be the date used at the next rollover. 

If that is not what is happening I need a clearer explanation of what you are seeing.


was (Author: ralph.goers@dslextreme.com):
I believe this is a duplicate of LOG4J2-2602. Please try the 2.12.0 release and see if that resolves the issue.

> 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)