[ https://issues.apache.org/jira/browse/LOG4J2-1676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15647134#comment-15647134 ]
Joern Huxhorn commented on LOG4J2-1676: --------------------------------------- Others may correct me but I'm pretty sure it's there because the "is the Throwable 'used up' while formatting the message" decision is implementation specific. "{0} {1}" vs. "{} {}" vs. "%s %s". {{getThrowable()}} should only return a {{Throwable}} if it is not 'used up' by placeholders. But then it definitely should and is doing so right now. The message factory being used can be specified via system property {{"log4j2.messageFactory"}}. I don't think that this is the best idea but that is an entirely different issue... > 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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org