logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhallammail-lo...@yahoo.com
Subject Problems with rollover of RollingFileAppender - data loss
Date Sun, 16 Nov 2008 22:47:17 GMT
Hi,

I'm running log4j-1.2.15 and have a problem that I'd like to put forward to see if anyone
has a solution.

I have an application that is very short lived but is run many times.  It's invoked by an
external scheduling and orchestration application that can only run the application by constructing
a fresh JVM via JNI every time it wants to run it.  The application logs using log4j and its
RollingFileAppender with append=true.

The problem that I have encountered is that I have observed that sometimes the log files are
getting partially wiped.  I am putting this down to the fact that the JVM might be shutting
down whilst the rolling activity is taking place - resulting in partially rolled files.  I
have tried adding a shutdown hook to invoke LogManager.shutdown() with the hope that this
would block until the appenders had finished doing their work before the JVM shutdown but
this doesn't appear to work.  I was able to replicate this by invoking the application many
times continually. It doesn't happen often (maybe 1% with my setup) - I think the conditions
have to be right, i.e. start rolling just before the app shuts down.

Has anyone got any ideas, solutions or workarounds?

Many thanks,

Dave



      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message