Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The solution required changes in a few places, and was largely an slf4j configuration issue. My app has numerous dependencies, and they introduce a variety of logging implementations. Slf4j was designed to corral them all together, and the process is often just an easy drop-in of a jar, but java.util.logging takes a bit more effort.</p> <p>The slf4j <a href="http://www.slf4j.org/legacy.html" rel="nofollow">Bridging Legacy APIs</a> page describes (mostly) how to wire up the JUL dependency introduced by Jersey. I had already included the jul-to-slf4j.jar, but it wasn't wired up correctly. I needed to execute <code>SLF4JBridgeHandler.install()</code> in the initialization of my app. In addition, the page cautions about negative performance implications unless I also include the following in my logback.xml file:</p> <pre><code>&lt;contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"&gt; &lt;resetJUL&gt;true&lt;/resetJUL&gt; &lt;/contextListener&gt; </code></pre> <p>That got me most of the way there, but introduced duplication of log events-- one went to slf4j and the other continued to stderr. Google directed me to an article in Claus Neilsen's Blog, "<a href="http://blog.cn-consult.dk/2009/03/bridging-javautillogging-to-slf4j.html" rel="nofollow">Bridging java.util.logging to SLF4J</a>". This contained a helpful snippet of code:</p> <pre><code>// Jersey uses java.util.logging - bridge to slf4 java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger(""); Handler[] handlers = rootLogger.getHandlers(); for (int i = 0; i &lt; handlers.length; i++) { rootLogger.removeHandler(handlers[i]); } SLF4JBridgeHandler.install(); </code></pre> <p>With that in place, the Jersey logs that were showing up in my jsvc stderr output are now showing up with the rest of my logs, nicely formatted, as directed by logback.xml.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload