org.slf4j

What is it

slf4j-api - "Simple Logging Facade for Java" - is a logging facade. For Java

Why use it

Logging facades let portions of a larger program emit text based logs without needing to know how those logs will be published.

This means external libraries will often emit logs via slf4j and expect that the application they are included in to publish them with a logging implementation.

slf4j-api is the most ubiquitous of these and the winner of the 90s "logging wars."

Getting Started

In order to have the code below emit any output, you need to make sure a logging implementation is included in your project. I'll introduce one of those tomorrow.

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

void main() {
    Logger logger = LoggerFactory.getLogger(getClass());
    logger.info("Hello World");
}

<- Index