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 "Paul Benedict (JIRA)" <ji...@apache.org> on 2012/09/18 17:54:08 UTC

[jira] [Comment Edited] (LOG4J2-86) Provide a logging methods with only a Throwable object as parameters

    [ https://issues.apache.org/jira/browse/LOG4J2-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13457895#comment-13457895 ] 

Paul Benedict edited comment on LOG4J2-86 at 9/19/12 2:53 AM:
--------------------------------------------------------------

I am very concerned this will lead to unexpected behavior when upgrading. The single-arg method info(Object o) is meant to print the toString() method of the object; the method info(Object, Throwable) is meant to print toString() and a stack trace. People who are already passing a Throwable to info(Object o) know they will only get the exception's message, but the new overloaded version will now silently take precedence at compile time and give them a stack trace too.
                
      was (Author: paul4christ79):
    I am very concerned this will lead to unexpected behavior when upgrading. The single-arg method info(Object o) is meant to print the toString() method of the object; the method info(String, Throwable) is meant to print a message and a stack trace. People who are already passing a Throwable to info(Object o) know they will only get a message, but the new overloaded version will now silently take precedence at compile time and give them a stack trace.
                  
> Provide a logging methods with only a Throwable object as parameters
> --------------------------------------------------------------------
>
>                 Key: LOG4J2-86
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-86
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: API
>            Reporter: Ivan Anev
>             Fix For: 2.0-beta1
>
>
> Provide logging methods with only a Throwable object as a single parameter:
> info(Throwable e)
> error(Throwable e)
> ...
> The throwable objects contain a message themself and a stacktrace. So most of the times its pointless to log additional message. So in order to log them now you have to log an empty message and the throwable object:
> logger.error("", e);
> Which is obviously ugly and pointless when there is no reason not to have method like:
> logger.error(e);
> that should log both the message and the stacktrace.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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