is there a way to set number of days the log files will backed up daily like 15 days or 30 days then over write the old files
org.apache.log4j.DailyRollingFileAppender thanks in advance
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32769
posted
0
The files wouldn't get overwritten, since they all have different names. Do you mean deleting them after a certain period? I don't think there is a way to do this. You could roll your own by extending DailyRollingFileAppender, and add an additional parameter to that effect. Or create a background thread that cleans up periodically (I wouldn't delete log files, though, but zip then up and store them someplace else).
create a background thread that cleans up periodically (I wouldn't delete log files, though, but zip then up and store them someplace else). yes i mean to clean up the directory periodically . is there a way log4j does this or we need to write code for this ? thanks for the reply
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32769
posted
0
Cleaning up the directory has nothing to do with logging directly, and log4j will not help you there. You'll need to write some code that starts a thread which executes once a week or once a month, and which then deletes whatever files you want to get rid of.