Source Code for SLF4J Bridge to JDK

SLF4J Bridge to JDK is a binding bridge that implements the SLF4J API with JDK logging library.

Here is the source code for SLF4J Bridge to JDK. You can download its pre-compiled version slf4j-jdk14-2.0.4.jar at SLF4J Download Website.

✍:

org/slf4j/jul/JULServiceProvider.java

package org.slf4j.jul;

import org.slf4j.ILoggerFactory;
import org.slf4j.IMarkerFactory;
import org.slf4j.helpers.BasicMDCAdapter;
import org.slf4j.helpers.BasicMarkerFactory;
import org.slf4j.spi.MDCAdapter;
import org.slf4j.spi.SLF4JServiceProvider;

public class JULServiceProvider implements SLF4JServiceProvider {

    /**
     * Declare the version of the SLF4J API this implementation is compiled
     * against. The value of this field is modified with each major release.
     */
    // to avoid constant folding by the compiler, this field must *not* be final
    public static String REQUESTED_API_VERSION = "2.0.99"; // !final

    private ILoggerFactory loggerFactory;
    private IMarkerFactory markerFactory;
    private MDCAdapter mdcAdapter;

    @Override
    public ILoggerFactory getLoggerFactory() {
        return loggerFactory;
    }

    @Override
    public IMarkerFactory getMarkerFactory() {
        return markerFactory;
    }

    public MDCAdapter getMDCAdapter() {
        return mdcAdapter;
    }

    @Override
    public String getRequestedApiVersion() {
        return REQUESTED_API_VERSION;
    }

    @Override
    public void initialize() {
        loggerFactory = new JDK14LoggerFactory();
        markerFactory = new BasicMarkerFactory();
        mdcAdapter = new BasicMDCAdapter();
    }
}

org/slf4j/jul/JULServiceProvider.java

 

Or download all of them as a single archive file:

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

 

Source Code for SLF4J Extensions

Source Code for SLF4J Simple Logging

Downloading and Reviewing SLF4J Packages

⇑⇑ SLF4J - Simple Logging Facade for Java

2021-11-30, 1520👍, 0💬