logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner" <dpsen...@gmail.com>
Subject RE: RollingFileAppender overwrites file if already rolled by another process
Date Wed, 28 Dec 2011 09:39:15 GMT
Hi Walden,

>The problem I'm seeing is that if another process has already rolled the 
>file (assuming a locking model other than exclusive) then the second (and 
>subsequent) process to perform the same "roll" will attempt to open the new

>file with a false for the append parm and thus overwrite anything in the 
>file already.

That's a decision that was made at design time. :-) Without taking a closer
look at it, I would guess that 's/false/true/' wouldn't work either. It
would at best truncate the file, too. At worst it would raise typical race
conditions (random behaviour) because context switches can happen at every
non-atomic operation of all processes involved. The only real solutions are
to either:

1] use exclusive lock when logging into the same file from several processes
2] configure an event/rcp appender that invokes a file appender which is the
only one appending to the file

JMTC and comments welcome.


View raw message