Search code examples
visual-c++log4cxx

Log4cxx DailyRollingFileAppender not rolling over


I have an application that only runs when triggered by hardware. An legacy c++ application that we recently added log4cxx too, to generate logs to help debug rare production issues. We of course wanted daily logfiles.

It turns out that we never got rolling files.

To debug the problem we set it roll over on the minute rather than the day. We found that if the program was called within a few seconds from the top of the minute, the file would roll over. If it was called more than 5 seconds after the top of the minute, roll over did not occur.

In testing the program takes roughly 5 seconds to run.

Is there anyway to have log4 rollover the file when the program starts, if needed?

i.e. If we logged at minute 6 and then don't run again until minute 50, we'll roll over the log file before we starting logging for minute 50, rather than just appending to minute 6.


Solution

  • Turns out a bug in the log4cxx implementation. :(