logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Log4j 1.2.x deadlock, bug or faulty usage?
Date Mon, 20 Oct 2008 16:22:18 GMT

On Oct 20, 2008, at 8:27 AM, Frank Karlstrom wrote:

> We are experiencing deadlocks on our server.
> We have tested with log4j version 1.2.8 up to and including 1.2.15
> We have identified that cause to be a log statement inside a  
> synchronized block,
> which is called from different threads.
> We have attached to very simplified classes, to reproduce the  
> deadlock. Our framework is a lot more complex, where log4j can be  
> called indirectly with reflection, not neccessarily by us, but from  
> third party libraries etc.
> The deadlock can be reproduced always.
> Is our usage (or library usage) of log4j faulty, or is it a bug?

The example provided results in a logging request being made during  
the toString() method of a message parameter.  If you pass an  
arbitrary object as a message, you have to insure that it does not  
make any log4j logging requests in the evaluation of toString().  This  
is a known weakness of log4j 1.x, but can not be addressed outside of  
a major version change.  It is an issue in the log4j 2.0 JIRA which  
lists requirements and wishes for log4j 2.0 development (https://issues.apache.org/jira/browse/LOG4J2-8


To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message