Turns out my issue is because the log4j.properties file that was found 
(and I don't control) configured 2 loggers to use the same named appender.
Subsequently, when I did  a PropertyConfigurator.configure(), one of the 
existing loggers had all of its appenders closed and removed.

Therefore the other original logger now has a closed appender in its list 
of AppenderAttachableImpls, and it complains about "attempting to write to 
a closed appender" when logging is performed. The annoying thing is that 
the only (current) way to get rid of this behavior is to call 
LogManager.resetConfiguration(), which seems a bit heavy handed. Please 
tell me if I'm wrong here.

As a suggestion, maybe calls to PropertyConfiguration.configure() should 
only close appenders that are not in use by any other logger. I think it 
should remove them from the Loggers that are being reconfigured, as the 
1.2.8 code currently does.

I would programmatically remove the closed appenders in my case, but the 
boolean that indicates closed status of an appender is currently 
protected, so it would require log4j code changes to get there--this is 
something else to consider adding. Again, if you know of a way, please 
enlighten me.


Tom

Reply via email to