Reputation: 2209
I came across this library for logging slf4j in my assignment. I have used apache log4j library before but from the documentation I could not understand the use case for the slf4j library. (face palm) Can any one tell me the advantages of using SLF4j or possible real world cases.
Upvotes: 3
Views: 1903
Reputation: 52185
According to the SLF4J Website (Bold annotations is something I made):
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.
Thus, it would seem that the SLF4J library provides an abstraction of the underlying logging framework used. This, as per their website, would allow you to write applications which are independent of the logging framework used since SLF4J wraps over the underlying logging mechanism. Thus, as far as your application would be concerned, it won't care what underlying logging mechanism you are using.
Upvotes: 7