[Log4cplus-devel] rotate after logging to wrong file?
Logging Framework for C++
Brought to you by:
wilx
|
From: Jeremy C. R. <re...@re...> - 2013-06-10 18:08:19
|
I noticed that I had a few processes still with open log files and when
they logged they logged to the old log file instead of new file.
This means that an admin may overlook it or, even worse, it may be
rotated and lost.
Is this a feature?
Here is a workaround that seems to work for me:
--- ./src/fileappender.cxx.orig 2013-06-07 11:43:19.000000000 -0500
+++ ./src/fileappender.cxx 2013-06-07 11:45:06.000000000 -0500
@@ -488,11 +488,13 @@
void
RollingFileAppender::append(const spi::InternalLoggingEvent& event)
{
- FileAppender::append(event);
+ // Rotate log file if needed before appending to it.
if(out.tellp() > maxFileSize) {
rollover(true);
}
+
+ FileAppender::append(event);
}
This is with BIND10 which has many logging processes using a single
log4cplus configuration. For information, see
http://bind10.isc.org/ticket/1622#comment:34
http://bind10.isc.org/ticket/2988
Jeremy C. Reed
echo 'EhZ[h ^jjf0%%h[[Zc[Z_W$d[j%Xeeai%ZW[ced#]dk#f[d]k_d%' | \
tr '#-~' '\-.-{'
|