Does the DailyRolingFileAppender in log4j roll over if the program is not continuously running? I have a batch job written in Java that runs once a day and it is not continuously running. I am using log4j for logging. I have it configured to roll over each day and each new day that it runs it does not roll over to a new log file. It just appends to the old existing log file from the previous day. Does the program need to be continuously running for this feature to work?
Based on Benjamin's tests with programs which don't run continuously and my experience with programs which do run continuously, I'd have to say that the answers to his questions are:
Benjamin Hundley wrote:Does the DailyRolingFileAppender in log4j roll over if the program is not continuously running?
Does the program need to be continuously running for this feature to work?
Joined: Dec 19, 2008
I found out why rollover is not working for me. The reason is, I am using multiple file appenders which write to same file. if we use multiple file appenders to write to a single file, log4j has issues with rollover for DailyRollingFileAppender.
And the program does not need to run continuously for log4 j to rollover. Rollover does not take place at the end of timeframe mentioned, instead, it takes place while writing first time to log after the timeframe.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com