org.slf4j.spi.MDCAdapter Java Examples

The following examples show how to use org.slf4j.spi.MDCAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KonkerLoggingEvent.java    From konker-platform with Apache License 2.0 6 votes vote down vote up
public Map<String, String> getMDCPropertyMap() {
    if(this.mdcPropertyMap == null) {
        MDCAdapter mdc = MDC.getMDCAdapter();
        if(mdc instanceof LogbackMDCAdapter) {
            this.mdcPropertyMap = ((LogbackMDCAdapter)mdc).getPropertyMap();
        } else {
            this.mdcPropertyMap = mdc.getCopyOfContextMap();
        }
    }

    if(this.mdcPropertyMap == null) {
        this.mdcPropertyMap = CACHED_NULL_MAP;
    }

    return this.mdcPropertyMap;
}
 
Example #2
Source File: StaticMDCBinder.java    From HttpSessionReplacer with MIT License 5 votes vote down vote up
/**
 * Currently this method always returns an instance of
 * {@link StaticMDCBinder}.
 * @return
 */
public MDCAdapter getMDCA() {
  try {
    return (MDCAdapter) Class.forName(getMDCAdapterClassStr()).newInstance();
  } catch (Exception e) { // NOSONAR we can't log here as we are actually instantiating log here
    System.err.println("Unable to instantiate mdc adapter " + getMDCAdapterClassStr()); // NOSONAR
    e.printStackTrace(); // NOSONAR
    return new NOPMDCAdapter();
  }
}
 
Example #3
Source File: StaticMDCBinder.java    From component-runtime with Apache License 2.0 4 votes vote down vote up
public MDCAdapter getMDCA() {
    return new BasicMDCAdapter();
}
 
Example #4
Source File: SLF4JServiceProvider.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public MDCAdapter getMDCAdapter() {
    return mdcAdapter;
}
 
Example #5
Source File: StaticMDCBinder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public MDCAdapter getMDCA() {
   return new BasicMDCAdapter();
}
 
Example #6
Source File: StaticMDCBinder.java    From logging-interceptor with Apache License 2.0 4 votes vote down vote up
public MDCAdapter getMDCA() {
    return adapter;
}
 
Example #7
Source File: StaticMDCBinder.java    From logging-interceptor with Apache License 2.0 4 votes vote down vote up
public static MDCAdapter mdc() {
    return SINGLETON.getMDCA();
}
 
Example #8
Source File: Slf4jEclipseLoggerServiceProvider.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized MDCAdapter getMDCAdapter() {
	return this.mdc;
}
 
Example #9
Source File: RequestScopedMdc.java    From armeria with Apache License 2.0 4 votes vote down vote up
Adapter(MDCAdapter delegate) {
    this.delegate = requireNonNull(delegate, "delegate");
}
 
Example #10
Source File: StaticMDCBinder.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
public MDCAdapter getMDCA() {
    return new ThreadLocalMDCAdapter();
}
 
Example #11
Source File: DefaultLoggerServiceProvider.java    From core-ng-project with Apache License 2.0 4 votes vote down vote up
@Override
public MDCAdapter getMDCAdapter() {
    return mdcAdapter;
}
 
Example #12
Source File: StaticMDCBinder.java    From ymate-platform-v2 with Apache License 2.0 4 votes vote down vote up
public MDCAdapter getMDCA() {
    return new BasicMDCAdapter();
}
 
Example #13
Source File: KonkerMDCLogger.java    From konker-platform with Apache License 2.0 4 votes vote down vote up
public static MDCAdapter getMDCAdapter() {
    return mdcAdapter;
}
 
Example #14
Source File: KonkerMDCLogger.java    From konker-platform with Apache License 2.0 4 votes vote down vote up
private static MDCAdapter bwCompatibleGetMDCAdapterFromBinder() throws NoClassDefFoundError {
    return StaticMDCBinder.SINGLETON.getMDCA();
}
 
Example #15
Source File: TtlMDCAdapter.java    From logback-mdc-ttl with Apache License 2.0 4 votes vote down vote up
public static MDCAdapter getInstance() {
    return mtcMDCAdapter;
}
 
Example #16
Source File: TtlMDCAdapter.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
public static MDCAdapter getInstance() {
    return mtcMDCAdapter;
}
 
Example #17
Source File: StaticMDCBinder.java    From xltsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Currently this method always returns an instance of
 * {@link StaticMDCBinder}.
 */
public MDCAdapter getMDCA() {
   return new NOPMDCAdapter();
}
 
Example #18
Source File: StaticMDCBinder.java    From joynr with Apache License 2.0 2 votes vote down vote up
/**
 * Currently this method always returns an instance of
 * {@link StaticMDCBinder}.
 */
public MDCAdapter getMDCA() {
    return new NOPMDCAdapter();
}
 
Example #19
Source File: StaticMDCBinder.java    From logging-log4j2 with Apache License 2.0 2 votes vote down vote up
/**
 * Currently this method always returns an instance of {@link StaticMDCBinder}.
 * @return an MDC adapter
 */
public MDCAdapter getMDCA() {
    return new Log4jMDCAdapter();
}