logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37182] Exception from exception toString() causes log4j to fail
Date Wed, 06 Aug 2008 04:17:35 GMT

Curt Arnold <carnold@apache.org> changed:

           What    |Removed                     |Added
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Curt Arnold <carnold@apache.org>  2008-08-05 21:17:35 PST ---
The first patch would be appropriate if the problem were:


However, that isn't the problem reported and control would not reach
DefaultRenderer since LoggingEvent.getRenderedMessage would short circuit it.  

The problem is passing any object whose toString() method may result in either
a RuntimeException or Error.  By far the most common message parameter is a
String, but that is handled by a special case check in
LoggingEvent.getRenderedMessage.  Adding the try/catch block in DefaultRenderer
will add some overhead, but only in the uncommon case where the message isn't a
String.  It isn't obvious what should be returned in that case, I have chosen
to return the ex.toString() of the exception.  If you want something else, you
could provide your own renderer (or make sure that your message object does not
throw an exception).

Committed rev 683102.

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

View raw message