You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2009/04/30 02:44:07 UTC

DO NOT REPLY [Bug 47123] New: TimeBasedRollingPolicy appends logs into a old log file, instead of rolling the log file.

https://issues.apache.org/bugzilla/show_bug.cgi?id=47123

           Summary: TimeBasedRollingPolicy appends logs into a old log
                    file, instead of rolling the log file.
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: AIX
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: dsnewman@sbcglobal.net


If you use TimeBasedRollingPolicy to rollover a log file and the application
wasn't running at the time the log file should have rolled, e.g. midnight, the
next time the application runs, it appends the log content into the old file
rather than roll the log and create a new file.

EVIDENCE:
1. refer to attached file to see my log4j.xml settings.
2. The FileNamePattern is 'ApproverSelection_Daily.%d.log.gz', so the log file
should roll every day at midnight, or the first time a cron job runs after
midnight. For my application, the first time it runs after midnight is 5
minutes after, i.e. 00:05. The ApproverSelection_Daily.log file should have
rolled when this app ran at 00:05 to become
ApproverSelection_Daily.2009-04-28.log.gz. It did not. Instead, the log entries
for 2009-04-29 are still placed in the old log along with 2009-04-28 log
entries.

2009-04-29 23:35:22,500  main INFO 
finance.access.approver.controller.ApproverSelectionControllerForOneTeam -
Reading from JMS.
2009-04-29 23:35:27,554  main INFO 
finance.access.approver.controller.ApproverSelectionControllerForOneTeam - No
requests in queue.
2009-04-29 23:35:27,555  main INFO 
finance.access.approver.controller.ApproverSelectionControllerForOneTeam -
ApproverSelectionController.main() terminating with default status code
2009-04-30 00:05:11,997  main INFO 
finance.access.approver.controller.ApproverSelectionControllerForOneTeam -
Reading from JMS.
2009-04-30 00:05:25,834  main INFO 
finance.access.approver.controller.ApproverSelectionControllerForOneTeam - No
requests in queue.
2009-04-30 00:05:25,835  main INFO 
finance.access.approver.controller.ApproverSelectionControllerForOneTeam -
ApproverSelectionController.main() terminating with default status code

I've been Googling this issue all day and noticed that the same issue seems to
occur in log4j, log4cxx, and logback. I believe the same developer(s) has
created all of these, porting the same bug to all of them, so shifting
frameworks won't help. I'd very much appreciate your attention on this.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 47123] TimeBasedRollingPolicy appends logs into a old log file, instead of rolling the log file.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47123

--- Comment #1 from werner.heine@steria-mummert.de 2010-08-17 10:31:39 EDT ---
Created an attachment (id=25897)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25897)
Patch for TimeBasedRollingPolicy

After applying this patch, the TimeBasedRollingPolicy will check in the
initalize method if an already existing log file has to be rolled before
continuing logging

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org