Simple Logging Facade for Java (SLF4J)

The Simple Logging Facade for Java or (SLF4J) is intended to serve as a simple facade for various logging APIs allowing to the end-user to plug in the desired implementation at deployment time. SLF4J also allows for a gradual migration path away from Jakarta Commons Logging (JCL).

Logging API implementations can either choose to implement the the SLF4J interfaces directly, e.g. NLOG4J or SimpleLogger. Alternatively, it is possible (and rather easy) to write SLF4J adapters for the given API implementation, e.g. Log4jLoggerAdapter or JDK14LoggerAdapter..

Simplicity

The SLF4J interfaces and their various adapters are simple and straightforward. Most developers familiar with the Java language should be able to read and fully understand the code in less than one hour.

SLF4J does not rely on any special class loader machinery. In fact, the binding between SLF4J and a given logging API implementation is performed statically at compile time. Each binding is hardwired to use one and only specific logging API implementation. Each binding corresponds to one jar file. At deployment time, you simply drop the binding of your choice, that is a jar file, onto the appropriate class path location. As a consequence of this simple approach, SLF4J suffers from none of the class loader problems or memory leaks observed with Jakarta Commons Logging (JCL).

We hope that simplicity of the SLF4J interfaces and the deployment model will make it easy for developers of other logging APIs to conform to the SLF4J model.