[slf4j-user] Questions about SLF4JBridgeHandler

ceki ceki at qos.ch
Tue Feb 7 18:05:36 CET 2012


On 29.01.2012 06:15, cowwoc wrote:
> Hi,
>
> I've got three questions:
>
> 1. http://www.slf4j.org/legacy.html mentions LevelChangePropagator but
> http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html does not.
> Is it possible to add this to the Javadoc?

Done.

> 2. Why doesn't SLF4JBridgeHandler.install() register the listener
> automatically?

LevelChangePropagator is in logback-classic and I wanted to avoid adding 
a dependency to logback-classic in jul-to-slf4j.

> 3. I've noticed that invoking SLF4JBridgeHandler.install() is not enough.
> You must remove any existing JUL handlers using:
>
> java.util.logging.Logger rootLogger =
>        java.util.logging.LogManager.getLogManager().getLogger("");
>      java.util.logging.Handler[] handlers = rootLogger.getHandlers();
>      for (int i = 0; i<  handlers.length; i++) {
>        rootLogger.removeHandler(handlers[i]);
>      }
>
> before invoking SLF4JBridgeHandler.install(). Shouldn't SLF4JBridgeHandler
> offer a method for doing it on behalf of the user?

Good idea. Will do.

> Thanks,
> Gili


-- 
Ceki
http://twitter.com/#!/ceki


More information about the slf4j-user mailing list