Bug 876489 - slf4j-jboss-logmanager does not support parametization of a logging statement in the presence of a Throwable
Summary: slf4j-jboss-logmanager does not support parametization of a logging statement...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Logging
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER1
: EAP 6.1.1
Assignee: James Perkins
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-14 09:40 UTC by Takayuki Konishi
Modified: 2018-11-29 19:28 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-12-15 17:01:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBLOGGING-85 0 Major Resolved slf4j-jboss-logmanager does not support parametization of a logging statement in the presence of a Throwable 2014-08-13 10:51:01 UTC

Description Takayuki Konishi 2012-11-14 09:40:26 UTC
Description of problem:


http://www.slf4j.org/faq.html#paramException describes that from slf4j 1.6 onwards doing the following will print a stacktrace:

logger.error("Failed to format {}", s, e);

However, due to the implementation of org.slf4j.impl.MessageFormatter in slf4j-jboss-logmanager, when logger.error(String, Object, Object) is called, even if the third parameter is a Throwable, it is not recognised as such.

Investigating further, it seems that org.slf4j.impl.MessageFormatter is probably just an old copy of org.slf4j.helpers.MessageFormatter in slfj-api 1.6.1, where most formatting methods used to return a String now returns a FormattingTuple.

This issue can be fixed by making all calls in Slf4Logger to org.slf4j.impl.MessageFormatter to call org.slf4j.helpers.MessageFormatter instead and appropriately call ExtLogRecord.setThrown(formattingTuple.getThrowable()).


Version-Release number of selected component (if applicable):


How reproducible: 100 %


Steps to Reproduce:
try { throw new RuntimeException("bla bla"); } catch (RuntimeException e) {
logger.error("Text: {}", "mytext", e);
}

  
Actual results:
No stacktrace is printed, not even e.getMessage(). It is completely ignored.

Expected results:
Stacktrace is printed.

Comment 1 JBoss JIRA Server 2013-01-29 21:54:55 UTC
James Perkins <jperkins> updated the status of jira JBLOGGING-85 to Resolved

Comment 2 JBoss JIRA Server 2013-01-29 21:54:55 UTC
James Perkins <jperkins> made a comment on jira JBLOGGING-85

Pull request merged.

Comment 4 James Perkins 2013-09-20 22:11:15 UTC
This actually looks like it was done on 6.1.1.ER1 with an upgrade to the slf4j-jboss-logmanager. Commit was https://github.com/jbossas/jboss-eap/commit/872fd1c8056062ac233421bd64c4db50ca74cae2

Comment 5 Ondrej Lukas 2013-10-08 10:22:33 UTC
Verified on EAP 6.2.0.ER4


Note You need to log in before you can comment on or make changes to this bug.