SLF4J API Source Code

SLF4J API is a simple API that allows to plug in any desired logging library at deployment time.

Here is the source code for SLF4J API 2.0.4. You can download its pre-compiled version slf4j-api-2.0.4.jar at SLF4J Download Website.

✍: FYIcenter.com

org/slf4j/spi/SLF4JServiceProvider.java

package org.slf4j.spi;

import org.slf4j.ILoggerFactory;
import org.slf4j.IMarkerFactory;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

/**
 * This interface based on {@link java.util.ServiceLoader} paradigm. 
 * 
 * <p>It replaces the old static-binding mechanism used in SLF4J versions 1.0.x to 1.7.x.
 *
 * @author Ceki G&uml;lc&uml;
 * @since 1.8
 */
public interface SLF4JServiceProvider {

    /**
     * Return the instance of {@link ILoggerFactory} that 
     * {@link org.slf4j.LoggerFactory} class should bind to.
     * 
     * @return instance of {@link ILoggerFactory} 
     */
    public ILoggerFactory getLoggerFactory();

    /**
     * Return the instance of {@link IMarkerFactory} that 
     * {@link org.slf4j.MarkerFactory} class should bind to.
     * 
     * @return instance of {@link IMarkerFactory} 
     */
    public IMarkerFactory getMarkerFactory();

    /**
     * Return the instance of {@link MDCAdapter} that
     * {@link MDC} should bind to.
     * 
     * @return instance of {@link MDCAdapter} 
     */
    public MDCAdapter getMDCAdapter();

    /**
     * Return the maximum API version for SLF4J that the logging
     * implementation supports.
     *
     * <p>For example: {@code "2.0.1"}.
     *
     * @return the string API version.
     */
    public String getRequestedApiVersion();

    /**
     * Initialize the logging back-end.
     * 
     * <p><b>WARNING:</b> This method is intended to be called once by 
     * {@link LoggerFactory} class and from nowhere else. 
     * 
     */
    public void initialize();
}

org/slf4j/spi/SLF4JServiceProvider.java

 

Or download all of them as a single archive file:

File name: slf4j-api-2.0.4-sources.jar
File size: 70304 bytes
Release date: 2022-11-17
Download 

 

Source Code for SLF4J Simple Logging

Downloading SLF4J Components

Downloading and Reviewing SLF4J Packages

⇑⇑ SLF4J - Simple Logging Facade for Java

2020-02-13, 26775👍, 2💬