Description
A DailyRollingFileAppender is only rolling the log file if the program is currently running.
Example log4cxx.properties:
log4j.appender.file = org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.datePattern='.'yyyy-MM-dd
with this configuration, the log file will only be rolled if the program is running at midnight.
This behaviour can be changed very easily:
file: timebasedrollingpolicy.cpp lines 107-111:
---------------------------------------------------------------
apr_time_t n = apr_time_now();
nextCheck = ((n / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
LogString buf;
ObjectPtr obj(new Date);
---------------------------------------------------------------
changed to:
---------------------------------------------------------------
apr_time_t n = apr_time_now();
nextCheck = ((n / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
File currentFile(currentActiveFile);
LogString buf;
ObjectPtr obj(new Date(currentFile.exists(pool) ? currentFile.lastModified(pool) : n));
---------------------------------------------------------------
I don't know if there is a better solution - this one works for me.