This was my question, and I would like to add my answer, since I found that the other two answers are not clear enough (although they are completely correct).
First check this line in the implementation of LoggerFactory.bind() in slf4j-api ( link )
There is a class called org.slf4j.impl.StaticLoggerBinder . Check out its implementation on github .
Now go and download slf4j-api.jar from the central maven repository, extract it and find the StaticLoggerBinder.class file.
Do not try! You can not. In fact, all org.slf4j.impl been removed from the package. Check project pom.xml :
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>process-classes</phase> <goals> <goal>run</goal> </goals> </execution> </executions> <configuration> <tasks> <echo>Removing slf4j-api dummy StaticLoggerBinder and StaticMarkerBinder</echo> <delete dir="target/classes/org/slf4j/impl"/> </tasks> </configuration> </plugin>
Finally, check out one of the SLF4j binding packages, for example slf4j-simple . Can you find the org.slf4j.impl.StaticLoggerBinder class?
In sum, when you have slf4j-api.jar next to one (and only one) binding packages in your runtime, you only have one org.slf4j.impl.StaticLoggerBinder class that performs the binding.
Rad
source share