[slf4j-user] Class path contains multiple SLF4J bindings: gossip and slf4j-log4j12

Robert Elliot rob at lidalia.org.uk
Thu Oct 7 17:35:37 CEST 2010


Gossip and log4J are both logging systems.  The big question is why your modules think they need to specify a logging system; in the case of gmaven I would guess because you are using it embedded but it can also run stand-alone.

In the case of the other module I would guess that it's a legacy one, and you should be using log4j-over-slf4j to redirect log4j to it (unless you actually want to use log4j).

You could try excluding gossip and log4j explicitly (by giving them "provided" scope) and choosing your own logging implementation such as logback.

If you do not it will be an arbitrary consequence of classloading order as to which logging system (gossip of log4j) ends up handling any log calls to SLF4J.

----- Original Message -----
> From: "Nils Breunese" <N.Breunese at vpro.nl>
> To: slf4j-user at qos.ch
> Sent: Thursday, 7 October, 2010 4:09:12 PM
> Subject: [slf4j-user] Class path contains multiple SLF4J bindings: gossip and slf4j-log4j12
> Hello all,
> 
> We have a fairly complex Maven build. One of the submodules uses
> org.codehaus.gmaven.runtime:gmaven-runtime-1.7:1.3 which brings in
> org.sonatype.gossip:gossip:1.0 as a dependency. Another submodule
> brings in org.slf4j:slf4j-log4j12:1.5.11 as a dependency. Both gossip
> and slf4j-log4j12 contain a org.slf4j.impl.StaticLoggerBinder class,
> so when starting our project we are greeted with the following
> messages:
> 
> ----
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/C:/files/sts-vpro/wtpwebapps/magnolia-site/WEB-INF/lib/gossip-1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/C:/files/sts-vpro/wtpwebapps/magnolia-site/WEB-INF/lib/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> ----
> 
> We have looked at http://www.slf4j.org/codes.html#multiple_bindings,
> but are still not certain how to resolve this situation. Does it make
> sense that the gossip jar contains a org.slf4j.impl.StaticLoggerBinder
> as well?
> 
> Nils.
> ------------------------------------------------------------------------
> VPRO
> phone: +31(0)356712911
> e-mail: info at vpro.nl
> web: www.vpro.nl
> ------------------------------------------------------------------------
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://qos.ch/mailman/listinfo/slf4j-user


More information about the slf4j-user mailing list