SLF4J API Binding to Logging Libraries

Q

How to bind SLF4J API to different Logging Libraries?

✍: Guest

A

Since SLF4J only provides an abstract logging API, it must be used together with a specific logging library like Log4J Logging framework.

Here are some options on how to bind SLF4J API to different logging libraries.

1. SLF4J API + No logging - Application uses slf4j-api.jar only. Logging messages goes nowhere.

2. SLF4J API + Logback logging - Application uses slf4j-api.jar, logback-classic.jar and logback-core.jar.

3. SLF4J API + Log4J logging - Application uses slf4j-api.jar, slf4j-log4j.jar, and log4j.jar.

4. SLF4J API + JDK logging - Application uses slf4j-api.jar and slf4j-jdk.jar.

5. SLF4J API + Simple logging - Application uses slf4j-api.jar, and slf4j-simple.jar.

6. SLF4J API + NOP (No Operation) logging - Application uses slf4j-api.jar, and slf4j-nop.jar.

SLF4J API Binding to Different Logging Libraries
SLF4J API Binding to Different Logging Libraries

 

Downloading SLF4J Components

What Is SLF4J API

Downloading and Reviewing SLF4J Packages

⇑⇑ SLF4J - Simple Logging Facade for Java

2021-11-13, 379👍, 0💬