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

Chris Pratt thechrispratt at gmail.com
Wed Aug 15 09:08:26 CEST 2012


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 at 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 at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120815/234b7890/attachment.html>


More information about the Logback-user mailing list