If you're using Spring, you can define something like:

<bean class="org.slf4j.bridge.SLF4JBridgeHandler" init-method="install"/>

As far as I know, there's no need to remove all the existing logging handlers, just remove the logging.properties file and none will be defined.
  (*Chris*)

On Tue, Aug 14, 2012 at 11:34 PM, Andrzej Zadorozny <andrzej.zadorozny@gmail.com> wrote:
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



_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user