Bug 876489

Summary: slf4j-jboss-logmanager does not support parametization of a logging statement in the presence of a Throwable
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Takayuki Konishi <tkonishi>
Component: LoggingAssignee: James Perkins <jperkins>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: brian.stansberry, olukas
Target Milestone: ER1   
Target Release: EAP 6.1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-15 17:01:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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