DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=43568>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43568 [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |LATER ------- Additional Comments From [EMAIL PROTECTED] 2007-10-31 09:44 ------- log4j 1.2's architecture is such that any attempt to log from within the scope of a log4j method will potentially deadlock. Eliminating the coarse-grained locking is a design goal for log4j 2.0, but it can't be done in log4j 1.2 without breaking appenders and layouts that depend on the current synchronization model. This is typically encountered when the toString() member of the message parameter makes log4j calls. However, if an exception parameters printStackTrace(Writer) method makes log4j calls the same type of deadlock situation could arise. The only potential remedy would be to prevent this situation from arising. One way to prevent it would be to create a custom layout that suppresses the stack trace for the problematic exceptions (assuming that you are using a FileAppender or other derived from WriterAppender). Something like: public class MyPatternLayout extends PatternLayout { // // returning false suppresses the default handling of // exceptions in WriterAppender public boolean ignoresThrowable() { return false; } private static boolean safeException(ThrowableInformation ti) { if (ti != null) { Throwable t = ti.getThrowable(); if (t != null) { if (t instanceof MyBadException1 || t instanceof MyBadException2) { return false; } } return true; } return false; } public String format(final LoggingEvent event) { String retval = super.format(event); if (safeException(event.getThrowableInfo()) { StringBuffer buf = new StringBuffer(retval); String[] trace = event.getThrowableStrRep(); if (trace != null) { for(int i = 0; i < trace.length; i++) { buf.append(trace[i]); buf.append(Layout.LINE_SEP); } } retval = buf.toString(); } else { // as much info on the bad exception that you can get // without triggering a log4j call } } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
