[logback-user] Backlog, SLF4J and jars using other logging frameworks

Ali Salehi salehiam at gmail.com
Sun Nov 7 07:41:40 CET 2010


Hi all,
I have a dependency to a jar file which is using java.util.logging. My code
uses Logback/slf4j framework. As I understood, slf4j will proxy other
logging frameworks.

I created the error using the following code:

logger = org.slf4j.LoggerFactory.getLogger("test1");

jdkLogger = java.util.logging.Logger.getLogger("test2");

logger.debug("Backlog logs ...")
jdkLogger.info("JDK Logs ...")

and my backlog.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" debug="false" >

    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">

        <encoder>
            <pattern>[%4p] [%d{ISO8601}] [%t] %c{1}: %m%n</pattern>

        </encoder>
    </appender>
    <root level="WARN">

        <appender-ref ref="stdout"/>

    </root>
</configuration>

When I execute the code, I see a log output from test2 while test1 gets
filtered by backlog. I was expecting that both messages to get filtered by
SLF4J/Backlog.

I have slf4j-api-1.6.1.jar, logback-classic-0.9.24.jar and
logback-core-0.9.24.jar files in my classpath.

I appreciate your comments,

-A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20101107/bab3746a/attachment.html>


More information about the Logback-user mailing list