Issue Type: Bug Bug
Assignee: SLF4J developers list
Attachments: demo.zip
Created: 09/Sep/15 12:17 AM
Description:

When a logging statement occurs using an extending class, in my case, XLogger, with a parameterized query, on a LocationAwareLogger, the LoggerWrapper will use the MessageFormatter, format the message, and then pass it onto the bounded logger with null as the throwable. The MessageFormatter has already identified the exception, if applicable, and parsed it out of the object list. It has also generated an object list for the remaining objects. In my case, the underlying logged, log4j12, simply ignored the object list, used the formatted string, and saw null for the exception.
Attached is a very simple example (with pom and log4j.properties file) to demonstrate the problem.

LoggerWrapperFailureDemo.java
package demo.slf4j.ext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.ext.XLogger;

public class LoggerWrapperFailureDemo
{
	static XLogger logger = new XLogger(LoggerFactory.getLogger(LoggerWrapperFailureDemo.class));
	static Logger traditional = LoggerFactory.getLogger(LoggerWrapperFailureDemo.class);
	
    public static void main( String[] args )
    {
    	Exception e = new Exception("foo", new Exception("bar"));
        logger.warn( "No Param", e);
        logger.warn( "Param: {}", "etc", e);
        traditional.warn( "No XLogger (So No LoggerWrapper {} ", "etc", e);
    }
}
Project: SLF4J
Priority: Major Major
Reporter: William Miller
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
_______________________________________________
slf4j-dev mailing list
slf4j-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Reply via email to