talira

Simple Logging Facade for Java

open sourceMITfree

SLF4J (Simple Logging Facade for Java) is a logging API for Java that sits in front of a real logging framework (java.util.logging, logback, log4j and others), so a library logs through slf4j-api and the application picks the framework at deployment time. With no provider on the class path it falls back to a no-op logger. Bridges route commons-logging, log4j and java.util.logging calls into SLF4J, and a migrator tool moves source files to its API. The 2.0.x series needs Java 8, adds a backward-compatible fluent logging API and is modularized for JPMS. QOS.ch, which also makes logback, maintains it and sells support contracts.

Problems it solves

  • let my Java library log without forcing a logging framework on its users
  • switch a Java app between logback and log4j without changing code
  • send commons-logging and java.util.logging output from dependencies into one logger
  • a standard logging API for Java and Kotlin

Features

  • one API in front of logback, log4j, java.util.logging and others
  • no-op fallback when no provider is present
  • bridges for commons-logging, log4j and java.util.logging
  • fluent logging API (2.0.x)
  • JPMS modules
  • migrator tool

Alternatives

The same job

These do what SLF4J does.

  1. Logback A reliable, fast and flexible logging framework for Java, successor to log4j 1.x
  2. Seq Self-hosted search and alerting for structured logs, traces and metrics

Compare SLF4J with the top 3