Clear rotated logs on startup in log4j using RollingFileAppender
Posted on 2010-08-20
I have my log4j config set up with MaxBackupIndex=1. When I close down the app then bring it up, it clears the main log file (which is what I want), but does not delete any rolled files from the previous run (this is what I want to change).
For example, if the log file is gui.log and I close the gui when gui.log and gui.log.1 exist, then I bring up the GUI again, I want gui.log cleared (which is happening) and gui.log.1 deleted (what I'm trying to figure out how to do).
Any suggestions would be most appreciated. Thanks!