You will use slf4j with log4j (or any other logging implementation). Therefore, if you use log4j with slf4j, you will need to provide the log4j configuration in log4j.properties. Thus, the advantage is that if you want to switch to Logback later, you just need to replace the jar binding file (for log4j it could be slf4j-log4j12-1.6.6.jar ) with a new binding bank and add the configuration for Logback. No code change.
This thread should help you.
SLF4J Manual
source share