SLF4J

Simple Logging Facade for Java
DeveloperCeki Gülcü
Stable release
2.0.20 Edit this on Wikidata / 22 September 2026; 55 days ago (22 September 2026)
Written inJava
Operating systemCross-platform
TypeLogging Tool
LicenseMIT License
Websiteslf4j.org Edit this on Wikidata
Repository

Simple Logging Facade for Java (SLF4J) provides a Java logging API by means of a simple facade pattern. The underlying logging backend is determined at runtime by adding the desired binding to the classpath and may be the standard Sun Java logging package java.util.logging, Log4j, Reload4j, Logback or tinylog.

The separation of the client API from the logging backend reduces the coupling between an application and any particular logging framework. This can make it easier to integrate with existing or third-party code or to deliver code into other projects that have already made a choice of logging backend.

SLF4J was created by Ceki Gülcü as a more reliable alternative to Jakarta Commons Logging framework. Research in 2013 on 10,000 GitHub projects found that the most popular Java library is SLF4J, along with JUnit, with 30.7% of projects using it. In January 2021, it was ranked as the second most popular project according to mvnrepository.

Similarities and differences with log4j 1.x

 LOG.debug("There are now " + count + " user accounts: " + userAccountList); // slower
 LOG.debug("There are now {} user accounts: {}", count, userAccountList);    // faster

Similarities and differences with log4j 2.x

Apache log4j 2.x supports all slf4j features.

Version history

Version 2

Version 2.0.0 was released on 2022-08-20. The latest version 2 release is 2.0.17 (2025-02-25).

Significant changes and feature additions:

  • Support for lambda syntax in passing messages to be logged.
  • Addition of a Fluent API.
  • Requires Java 8 or later.
  • Uses the ServiceLoader mechanism to find a logging backend.

Version 1

Version details can be found in the manual.

Significant versions include:

  • Version 1.7.36 and all newer releases are reproducible.
  • Version 1.7.35 slf4j-log4j12 module is replaced by slf4j-reload4j.
  • Version 1.7.33 adds support for reload4j via the slf4j-reload4j module. It is the latest stable release. See Download product page.
  • Version 1.7.5 yielded significant improvement in logger retrieval times.
  • Version 1.7.0 added support for varargs, requiring support for Java 5 or later.
  • Version 1.6 brought a no-operation implementation used by default if no binding found.
  • Version 1.1 releases in Maven repositories began 2006-09.

See also