Thread: [Log4cplus-devel] DailyRollingFileAppender does not honor maxBackupIndex
Logging Framework for C++
Brought to you by:
wilx
From: Deepak M. <dee...@hd...> - 2012-02-24 23:35:01
|
Hello All, I am using DailyRollingFileAppender with PatternLayout , with maxBackupIndex as 10 and with schedule as DAILY. It was observed that Log4cplus does not delete the backup files after 10 days. It keeps creating more. For quick debugging I enabled log4cplu internal logging with schedule set as MINUTELY and found that here also it does not create files with .1...n which inturn (per code) won't be found when it comes to deleting them after reaching maxBackupIndex. Is this a bug and if anybody else has any solution? Here's the output from log4cplus logging: log4cplus: Just opened file: E:\testlogs\TestLog_p360.log log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-49 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-49 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-50 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-50 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-51 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-51 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-52 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-52 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-53 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-53 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-54 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-54 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-55 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-55 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-56 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-56 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-57 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-57 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-58 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-58 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-59 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-07-59 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-00 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-00 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-01 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-01 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-02 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-02 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-03 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-03 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-04 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-04 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-05 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-05 log4cplus: Renaming file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-06 log4cplus: Renamed file E:\testlogs\TestLog_p360.log to E:\testlogs\TestLog_p360.log.2012-02-24-08-06 Thanks. |
From: Václav Z. <wi...@us...> - 2012-02-26 20:15:57
|
On 02/25/2012 12:34 AM, Deepak Muley wrote: > > Hello All, > > > > I am using DailyRollingFileAppender with PatternLayout , with > maxBackupIndex as 10 and with schedule as DAILY. > > It was observed that Log4cplus does not delete the backup files after > 10 days. It keeps creating more. > > > > For quick debugging I enabled log4cplu internal logging with schedule > set as MINUTELY and found that here also it does not create files with > .1…n which inturn (per code) won’t be found when it comes to deleting > them after reaching maxBackupIndex. > > > > Is this a bug and if anybody else has any solution? > This is not a bug. See <https://sourceforge.net/tracker/index.php?func=detail&aid=1257117&group_id=40830&atid=429073> for detail. > > > Here’s the output from log4cplus logging: > > log4cplus: Just opened file: E:\testlogs\TestLog_p360.log > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-49 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-49 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-50 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-50 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-51 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-51 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-52 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-52 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-53 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-53 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-54 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-54 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-55 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-55 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-56 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-56 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-57 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-57 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-58 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-58 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-59 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-59 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-00 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-00 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-01 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-01 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-02 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-02 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-03 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-03 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-04 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-04 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-05 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-05 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-06 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-06 > > > > Thanks. > -- VZ |
From: Deepak M. <dee...@hd...> - 2012-02-27 19:41:51
|
Thank you for the information. Few queries: 1. I am failing to understand when does it create a backup file in the first place. I tested with schedule set to minutely, daily and weekly and ran for long time but still did not see a single file getting created with .1, .2 extension. What is the premise for creating these files. It always creates with postfix with date (and its variations based on schedule) 2. If I use the DaillyRollingFileAppender is there a way to limit the number of days the log files are kept. i.e. always keep the seven newest logs or Do I have to use RollingFileAppender to achieve this. Thanks again, ~Deepak Muley -----Original Message----- From: Václav Zeman [mailto:wi...@us...] Sent: Sunday, February 26, 2012 11:59 AM To: Deepak Muley Cc: log...@li... Subject: Re: [Log4cplus-devel] DailyRollingFileAppender does not honor maxBackupIndex On 02/25/2012 12:34 AM, Deepak Muley wrote: > > Hello All, > > > > I am using DailyRollingFileAppender with PatternLayout , with > maxBackupIndex as 10 and with schedule as DAILY. > > It was observed that Log4cplus does not delete the backup files after > 10 days. It keeps creating more. > > > > For quick debugging I enabled log4cplu internal logging with schedule > set as MINUTELY and found that here also it does not create files with > .1…n which inturn (per code) won’t be found when it comes to deleting > them after reaching maxBackupIndex. > > > > Is this a bug and if anybody else has any solution? > This is not a bug. See <https://sourceforge.net/tracker/index.php?func=detail&aid=1257117&group_id=40830&atid=429073> for detail. > > > Here’s the output from log4cplus logging: > > log4cplus: Just opened file: E:\testlogs\TestLog_p360.log > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-49 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-49 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-50 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-50 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-51 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-51 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-52 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-52 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-53 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-53 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-54 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-54 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-55 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-55 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-56 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-56 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-57 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-57 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-58 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-58 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-59 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-07-59 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-00 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-00 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-01 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-01 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-02 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-02 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-03 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-03 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-04 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-04 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-05 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-05 > log4cplus: Renaming file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-06 > log4cplus: Renamed file E:\testlogs\TestLog_p360.log to > E:\testlogs\TestLog_p360.log.2012-02-24-08-06 > > > > Thanks. > -- VZ |
From: Václav Z. <vha...@gm...> - 2012-02-27 21:03:00
|
2012/2/27 Deepak Muley <dee...@hd...> > Thank you for the information. > > Few queries: > 1. I am failing to understand when does it create a backup file in the > first place. I tested with schedule set to minutely, daily and weekly and > ran for long time but still did not see a single file getting created with > .1, .2 extension. What is the premise for creating these files. It always > creates with postfix with date (and its variations based on schedule) > Try the TWICE_DAILY schedule. I believe it works in that case. > > 2. If I use the DaillyRollingFileAppender is there a way to limit the > number of days the log files are kept. i.e. always keep the seven newest > logs or Do I have to use RollingFileAppender to achieve this. > This is not possible with the DaillyRollingFileAppender. It would have to keep information about previous logs and even then that information would be lost between restarts of your application. -- VZ |