1 package org.slf4j.jul; 2 3 import org.slf4j.ILoggerFactory; 4 import org.slf4j.IMarkerFactory; 5 import org.slf4j.helpers.BasicMDCAdapter; 6 import org.slf4j.helpers.BasicMarkerFactory; 7 import org.slf4j.spi.MDCAdapter; 8 import org.slf4j.spi.SLF4JServiceProvider; 9 10 public class JULServiceProvider implements SLF4JServiceProvider { 11 12 /** 13 * Declare the version of the SLF4J API this implementation is compiled 14 * against. The value of this field is modified with each major release. 15 */ 16 // to avoid constant folding by the compiler, this field must *not* be final 17 public static String REQUESTED_API_VERSION = "2.0.99"; // !final 18 19 private ILoggerFactory loggerFactory; 20 private IMarkerFactory markerFactory; 21 private MDCAdapter mdcAdapter; 22 23 @Override getLoggerFactory()24 public ILoggerFactory getLoggerFactory() { 25 return loggerFactory; 26 } 27 28 @Override getMarkerFactory()29 public IMarkerFactory getMarkerFactory() { 30 return markerFactory; 31 } 32 getMDCAdapter()33 public MDCAdapter getMDCAdapter() { 34 return mdcAdapter; 35 } 36 37 @Override getRequestedApiVersion()38 public String getRequestedApiVersion() { 39 return REQUESTED_API_VERSION; 40 } 41 42 @Override initialize()43 public void initialize() { 44 loggerFactory = new JDK14LoggerFactory(); 45 markerFactory = new BasicMarkerFactory(); 46 mdcAdapter = new BasicMDCAdapter(); 47 } 48 } 49