[logback-user] Configuring jul-to-slf4j bridge

Andrzej Zadorozny andrzej.zadorozny at gmail.com
Wed Aug 15 08:34:07 CEST 2012


Hi there.

Quick question: is there a way to remove all existing JUL handlers and
install the SLF4JBridgeHandler, all via a configuration file such as
logback.xml, etc.?

Currently I do the following programmatically, but I would like to be able
to do this via a configuration file instead:


        // Remove any existing handlers from JUL's root logger.
        java.util.logging.Logger julLogger =
                java.util.logging.Logger.getLogger(JUL_ROOT_LOGGER_NAME);
        Handler[] julHandlerArray = julLogger.getHandlers();
        for ( Handler julHandler : julHandlerArray )  {
                julLogger.removeHandler(julHandler);
        }

        // Install the JUL to SLF4J bridge handler.
        SLF4JBridgeHandler.install();


Any input would be greatly appreciated.

Thank you very much.

-- 
Andrzej Zadorozny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120815/adfcf8d8/attachment.html>


More information about the Logback-user mailing list