logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shyam Pabbathi <spabb...@Brocade.COM>
Subject RE: Log file size grows larger than the size configured using log4j.appender.R.MaxFileSize
Date Wed, 31 Aug 2011 05:28:04 GMT
Thanks Andy, Fabian and Curt Arnold for your response. Yes, both dll and exe file are linked
to log4cxx.dll. Both trigger initialization of log4cxx. I will try to keep single initialization
as Andy mentioned.

-----Original Message-----
From: Curt Arnold [mailto:curt.arnld@gmail.com] On Behalf Of Curt Arnold
Sent: Monday, August 29, 2011 9:20 PM
To: Log4CXX User
Cc: log4cxx
Subject: Re: Log file size grows larger than the size configured using log4j.appender.R.MaxFileSize

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).

Mime
View raw message