Automatically pruning empty log files


The log file rotation code that I wrote a while back has been working well for several clients. Recently someone suggested that the design of their server's logging meant that they tended to generate lots of useful information on server start up and server shutdown and then nothing until the server had problems. This meant that they were ending up with lots of empty log files as the hourly, or daily, or weekly rotation period would create a new file and most of the time nothing would be written to it.

I've just added some code to the logging class so that it can be set to delete these empty log files if required. Once again this is done in such a way that it shouldn't impact the main line log writing code; though if the previous log is empty it's pretty unlikely that there's lots of logging going on right now...

Anyway, this change will be included in release 6.0 of The Server Framework which is due shortly.

Leave a comment