beam-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Cwik <lc...@google.com>
Subject Re: problem regarding multi binding in slf4j
Date Fri, 16 Jun 2017 01:18:29 GMT
SLF4J only supports a single logging backend (e.g. slf4j-log4j12), when
there are multiple on the classpath it uses the first one that is found.

You want to make sure that only one logging backend is on your classpath.
You can ensure that your project only uses one logging backend by using the
Maven dependency plugin (
https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html) like
so:
mvn dependency:tree -Dverbose

This will give you a tree of dependencies for your project. You'll want to
update your pom.xml and add exclusions for exclude any additional slf4j
logging backends that are found in the dependency tree.

Also, to get logging integration across multiple logging APIs, you'll want
to install bridges that adapt the different types of loggers to become
SLF4J loggers. More details about that on the SLF4J site
https://www.slf4j.org/legacy.html

You can also find lots of similar questions with answers about this on
stackoverflow, such as how to deal with multiple backends, how to exclude a
transitive maven dependency, etc....





On Thu, Jun 15, 2017 at 1:52 PM, Claire Yuan <claireyuan@yahoo-inc.com>
wrote:

> Hi all,
>   I am currently running the example in apache beam project and got some
> issue that I could not fix. I used the maven compile and here is what I
> noticed in building project:
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in [jar:file:/home/claireyuan/.
> m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-
> classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in [jar:file:/home/claireyuan/.
> m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.
> 7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> SLF4J: Actual binding is of type [ch.qos.logback.classic.util.
> ContextSelectorStaticBinder]
>   I check online with this problem and did some modification to the
> pom.xml file. Here is my dependency with SLF4J:
>     <dependency>
>       <groupId>org.apache.beam</groupId>
>       <artifactId>beam-sdks-java-core</artifactId>
>
>       <exclusions>
>         <exclusion>
>           <groupId>org.slf4j</groupId>
>           <artifactId>slf4j-log4j12</artifactId>
>         </exclusion>
>         <exclusion>
>           <groupId>log4j</groupId>
>           <artifactId>log4j</artifactId>
>         </exclusion>
>       </exclusions>
> Also with something added:
>     <dependency>
>       <groupId>ch.qos.logback</groupId>
>       <artifactId>logback-classic</artifactId>
>       <version>1.2.3</version>
>     </dependency>
> But seems like this problem still not solved. Would any of you provide any
> suggestion with this?
>
> Claire
>
>
>

Mime
View raw message