What’s the difference between slf4j-log4j12 and log4j-over-slf4j and when should each be used?
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.12</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> <version>1.7.12</version> </dependency>
Use this if your code or some libraries you are using uses Log4j directly, but you want to use a different SLF4J binding than Log4j. It will route the Log4j API calls to SLF4J to the binding you choose. You need to remove the Log4j library from your classpath and replace it with this dependency.
Use this if you want to use the Log4j 1.2 binding for SLF4J.
You shouldn’t use both of these libraries at the same time.
Please note also that Log4j 2 has been released.