We use ivy to manage a multi project java application, and recently this error started showing up when we do builds. What's causing this?

有帮助吗?

解决方案

This was fixed by adding the following line to the end of the dependencies section in ivy.xml:

<dependencies>
         
  <exclude module="log4j-over-slf4j" /> 
</dependencies>

Why was it an issue?

其他提示

It looks like the log4j bridge does not implement the full interface for log4j . If you are still using direct log4j calls, you will need both the slf4j bridge jar and the log4j jar

In your case it looks like you excluded the bridge jar, so all slf4j calls go directly to log4j instead of the bridge.

If your code invokes log4j through the xml file , this will work. However if your code programatically invokes log4j initialization this bridge is not going to work

I know this is a very old question but I wanted to share what worked out fine for me. If you have different artifacts of slf4j-log4j* for two projects that are interdependent on each other, for example spring data jpa and spring MVC, this happens. Keep it consistent or even better have a parent pom. In my case I had slf4j-log4j12 on my spring data jpa project and slf4j-log4j13 on my spring MVC one.

Comment this dependency from the pom.xml

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j13</artifactId>
    <version>
</dependency>

And add (or keep) the following one:

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.12</version>
</dependency>

Wherever you see a compile time error regarding Log4j, add the following import:

import org.apache.log4j.Logger;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top