Description:
|
I wish to use a RollingFileAppender that time stamps the name of the initial log file and then closes the initial log file at midnight (or any selected time) and opens a new time stamped log file for further logging, repeating this every midnight. For example, say that I start my program at 13:54:50 today and run it for the next three days. Using a base log file name of "MyLog", I want to see log files called:
MyLog.120605.135450.log
MyLog.120606.000000.log
MyLog.120607.000000.log
MyLog.120608.000000.log
Then, if on the third day, 8th June, I stop and restart the program at, say, 09:22:33, then I will get a further log file generated on restart called:
MyLog.120608.092233.log
This way all the log files are in date (and alphabetical) order and there is no risk of losing any log output on restarting the program.
Maybe achieving this is already possible using the standard components supplied, but after a long search I have not been able to find a way. If there is a way, please let me know.
Otherwise, if you can create a suitable file appender then please let me know. Or, if you can give me some pointers as to how to do it myself, I am very happy to write my own Java class.
|