In a project's pom.xml
I am seeing a dependency like below
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
Can someone let me know what is the difference between slf4j-log4j12
& log4j
?
Log4j 1.2
slf4j-log4j12
provides a bridge between SLF4J and Log4j 1.2 so that SLF4J knows about how to log using Log4j.You are using Log4j 1.2. That version's binding it is maintained by the SLF4J project. Here is a summary from the SLF4J docs:
Log4j 2
If you are using Log4j 2 or later, you will need a different binding JAR than
slf4j-log4j12
. That binding is maintained by the Log4j project. According to the Log4j docs:You must provide both dependencies if you want SLF4J to route logging to Log4j. Again, from the Log4j 2 docs: