logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joern Huxhorn (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1676) Use Message.getThrowable() in log(Message) methods
Date Tue, 08 Nov 2016 09:19:58 GMT

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

Joern Huxhorn edited comment on LOG4J2-1676 at 11/8/16 9:19 AM:
----------------------------------------------------------------

It is used to retrieve a potential {{Throwable}} from the parameter varargs of a message.

e.g.
{{logger.debug("{} {}", "one", "two", new Throwable())}}
should populate that field while
{{logger.debug("{} {} {}", "one", "two", new Throwable())}}
shouldn't. It should instead replace the last {} with {{t.toString()}}.


was (Author: huxi):
It is used to retrieve a potential {{Throwable}} from the parameter varargs of a message.

e.g.
{{logger.debug("{} {}", "one", "two", new Throwable())}}
should populate that field while
{{logger.debug("{} {} {}", "one", "two", new Throwable())}}
shouldn't. It should instead replace the last {{{}}} with {{t.toString()}}.

> Use Message.getThrowable() in log(Message) methods
> --------------------------------------------------
>
>                 Key: LOG4J2-1676
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1676
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.5, 2.6, 2.7
>            Reporter: Joern Huxhorn
>
> All {{log(Message)}} methods should use {{Message.getThrowable()}}, e.g.
> {code:java}
>     public void debug(final Message msg) {
>         logIfEnabled(FQCN, Level.DEBUG, null, msg, msg != null ? msg.getThrowable() :
null);
>     }
> {code}
> instead of the current
> {code:java}
>     public void debug(final Message msg) {
>         logIfEnabled(FQCN, Level.DEBUG, null, msg, null);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message