[slf4j-dev] [Bug 114] New: class/line/ method pattern layout not correct with XLogger debug/info/warn/error

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Thu Nov 20 00:31:02 CET 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=114

           Summary: class/line/method pattern layout not correct with
                    XLogger debug/info/warn/error
           Product: SLF4J
           Version: 1.5.x
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P1
         Component: Unspecified
        AssignedTo: dev at slf4j.org
        ReportedBy: jarndt196 at yahoo.com


When you use an XLogger and have the pattern layout configured to output class,
line, or method it doesn't behave properly.

Using logback as the implementation it outputs a '?'
Using log4j it outputs 'LoggerWrapper'

Using slf4j 1.5.5, and logback 0.9.11 or log4j 1.2.15

To recreate:
public class Slf4JTest extends TestCase {

        public void testLogging() {
                Logger logger = LoggerFactory.getLogger("TEST");
                logger.debug("test logger");
                XLogger xlogger = XLoggerFactory.getXLogger("TEST");
                xlogger.debug("test logger");
        }
}

LOG4j.properties:
log4j.rootLogger=WARN, CONSOLE
log4j.logger.TEST=DEBUG, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p %C{1}:%L %M - %m%n

LOGBACK.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
        <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
                <layout class="ch.qos.logback.classic.PatternLayout">
                        <pattern>
                                %d{ABSOLUTE} %-5level %class{36}:%L %M - %msg%n
                        </pattern>
                </layout>
        </appender>
        <logger name="TEST">
                <level value="DEBUG" />
        </logger>
        <root>
                <level value="WARN" />
                <appender-ref ref="CONSOLE" />
        </root>
</configuration>



Output from log4j:
2008-11-19 16:24:03,420 DEBUG Slf4JTest:14 testLogging - test Logger
2008-11-19 16:24:03,435 DEBUG LoggerWrapper:230 debug - test XLogger

Output from logback:
2008-11-19 16:28:44,969 DEBUG Slf4JTest:21 testLogging - test Logger
2008-11-19 16:28:45,015 DEBUG ?:? ? - test XLogger


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the slf4j-dev mailing list