You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2006/01/04 20:01:39 UTC

DO NOT REPLY [Bug 38125] - add Throwable to message pattern log methods

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=38125>.
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=38125





------- Additional Comments From carnold@apache.org  2006-01-04 20:01 -------
There are a couple of reasons that I'm not in favor of these changes:

1. I have a personal dislike of the MessageFormatter work-alike methods being on Logger to begin 
with.  I think they actually should be in a helper class which would allow the user to select which 
formatter they use (MessageFormatter or the JDK 1.5 formatter) and should be the actual JDK 
implementation and not a log4j subset of the MessageFormatter.

2. The motivation for the debug methods is to avoid the cost of formatting the message if the debug 
messages are being suppressed.  However, info and higher messages are generally enabled, so their is 
no significant optimization savings for short-cutting the formatter.  In these cases, use:

logger.warn(new MessageFormatter("foo {}").format(someObj))

3. Since throwing and catching an exception should are expensive, should be rare, and should result in 
a high level, the potential for optimization by deferring formatting again should be minimal.  In these 
cases, use:

logger.warn(new MessageFormatter("foo {}").format(someObj), t);

-- 
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org