Anything that might keep a lock of the file can prevent rolling from 
completing. For example, if somehow you had two appenders having the same file 
open, then you could would always fail on the rename. Is there any chance that 
two components (your EXE and maybe another DLL) both link against log4cxx.dll? 
If so, you will have two independent copies of log4cxx in memory that have no 
awareness of each other and could have both read the same config file and have 
two competing appenders attempting to write to the same file. Since they both 
will have the file open, neither one will be able to rename the file and 
rollovers will fail. The same situation would not occur with a static link 
since there would only be one instance of log4cxx in the application.

You could try debugging this by setting a breakpoint on the constructor of the 
rolling file appender and see how many times it is called and look at the 
calling stack. If it is only called once, then confirm where it is failing on 
rollover. If on the rename, check to see if any other process has a lock on the 
file (a backup, virus scanner, etc).

Reply via email to