Hi all,
<br>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. <br><br>I created the error using the following code:<div class="post-text">
<pre class="prettyprint"><code><span class="pln">logger </span><span class="pun">=</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">slf4j</span><span class="pun">.</span><span class="typ">LoggerFactory</span><span class="pun">.</span><span class="pln">getLogger</span><span class="pun">(</span><span class="str">"test1"</span><span class="pun">);</span><span class="pln"><br>
jdkLogger </span><span class="pun">=</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="pln">logging</span><span class="pun">.</span><span class="typ">Logger</span><span class="pun">.</span><span class="pln">getLogger</span><span class="pun">(</span><span class="str">"test2"</span><span class="pun">);</span><span class="pln"><br>
logger</span><span class="pun">.</span><span class="pln">debug</span><span class="pun">(</span><span class="str">"Backlog logs ..."</span><span class="pun">)</span><span class="pln"><br>jdkLogger</span><span class="pun">.</span><span class="pln">info</span><span class="pun">(</span><span class="str">"JDK Logs ..."</span><span class="pun">)</span><span class="pln"><br>
</span></code></pre>
<p>and my backlog.xml</p>
<pre class="prettyprint"><code><span class="pun"><?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"UTF-8"</span><span class="pun">?></span><span class="pln"><br>
</span><span class="tag"><configuration</span><span class="pln"> </span><span class="atn">scan</span><span class="pun">=</span><span class="atv">"false"</span><span class="pln"> </span><span class="atn">debug</span><span class="pun">=</span><span class="atv">"false"</span><span class="pln"> </span><span class="tag">></span><span class="pln"><br>
</span><span class="tag"><appender</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"stdout"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"ch.qos.logback.core.ConsoleAppender"</span><span class="tag">></span><span class="pln"><br>
</span><span class="tag"><encoder></span><span class="pln"><br> </span><span class="tag"><pattern></span><span class="pln">[%4p] [%d{ISO8601}] [%t] %c{1}: %m%n</span><span class="tag"></pattern></span><span class="pln"><br>
</span><span class="tag"></encoder></span><span class="pln"><br> </span><span class="tag"></appender></span><span class="pln"><br> </span><span class="tag"><root</span><span class="pln"> </span><span class="atn">level</span><span class="pun">=</span><span class="atv">"WARN"</span><span class="tag">></span><span class="pln"><br>
</span><span class="tag"><appender-ref</span><span class="pln"> </span><span class="atn">ref</span><span class="pun">=</span><span class="atv">"stdout"</span><span class="tag">/></span><span class="pln"><br>
</span><span class="tag"></root></span><span class="pln"><br></span><span class="tag"></configuration></span><span class="pln"><br></span></code></pre>
<p>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.</p>
<p>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.</p>
<p>I appreciate your comments, <br></p><p>-A</p>
</div><br><br>