How can I roll over my logfiles automatically at midnight?

Long-running applications tend to produce ever-increasing logfiles. For backup and cleanup purposes, however, it is often desirable to move the current logfile to a different location from time to time and start writing a new one. This is a non-trivial task, because it has to happen in sync with the logging system in order not to lose any messages in the process.

Luckily, Mark Pfeiffer's "Log::Dispatch::FileRotate" appender works well with Log::Log4perl to rotate your logfiles in a variety of ways. Note, however, that having the application deal with rotating a log file is not cheap. Among other things, it requires locking the log file with every write to avoid race conditions.

There are good reasons to use external rotators like "newsyslog" instead. See the entry "How can I rotate a logfile with newsyslog?" in the FAQ for more information on how to configure it. When using "Log::Dispatch::FileRotate", all you have to do is specify it in your Log::Log4perl configuration file and your ... more.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions