I've been playing with a test case all afternoon and I think there's a bug in 
the RollingFileAppender roll process when rolling by date.

Specifically in the RollOverTime method the call to SafeFileOpen (line 1209) 
should pass true not false in the append parm, no?

Current (1.2.12) code is:
       if (fileIsOpen)
       {
              // This will also close the file. This is OK since multiple close 
operations are safe.
              SafeOpenFile(m_baseFileName, false);
       }

but shouldn't that be:
       if (fileIsOpen)
       {
              // This will also close the file. This is OK since multiple close 
operations are safe.
              SafeOpenFile(m_baseFileName, true);
       }

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. This isn't likely seen when rolling by size as you'll just increment 
the file #, but when rolling by date both processes calculate the same new file 
name and the last one in wins.

In my limited testing the change from false to true above fixes this, but I 
grant I'm not an expert on log4net. Thoughts? Am I missing something?

-Walden


--
Walden H Leverich III
Tech Software &
BEC - IRBManager
(516) 627-3800 x3051
wald...@techsoftinc.com<mailto:wald...@techsoftinc.com>
http://www.TechSoftInc.com<http://www.techsoftinc.com/>
http://www.IRBManager.com<http://www.irbmanager.com/>

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

Reply via email to