Class Slf4jMdcTraceId

  • All Implemented Interfaces:
    LogCorrelation

    public class Slf4jMdcTraceId
    extends java.lang.Object
    implements LogCorrelation
    SLF4J MDC log correlation for trace ids.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allScopes()
      Whether to check and insert correlation identifiers for all context scopes.
      java.lang.String key()
      MDC key used for this log correlation.
      boolean normalize()
      Should the key name for this correlation identifier be normalized in MDC?
      java.lang.String value()
      Access or generate the correlation identifier for the current MDC scope.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Slf4jMdcTraceId

        public Slf4jMdcTraceId​(com.typesafe.config.Config config,
                               LoggingProvider logging)
    • Method Detail

      • allScopes

        public boolean allScopes()
        Description copied from interface: LogCorrelation
        Whether to check and insert correlation identifiers for all context scopes.

        Otherwise the default is to only insert at entry points, such as incoming HTTP requests.

        Specified by:
        allScopes in interface LogCorrelation
        Returns:
        whether to check log correlation for all context scopes
      • key

        public java.lang.String key()
        Description copied from interface: LogCorrelation
        MDC key used for this log correlation.
        Specified by:
        key in interface LogCorrelation
        Returns:
        MDC key for this correlation
      • value

        public java.lang.String value()
        Description copied from interface: LogCorrelation
        Access or generate the correlation identifier for the current MDC scope.
        Specified by:
        value in interface LogCorrelation
        Returns:
        MDC value for this correlation
      • normalize

        public boolean normalize()
        Description copied from interface: LogCorrelation
        Should the key name for this correlation identifier be normalized in MDC?

        For example, if MDC contains the key "correlation-id", but the key() is configured as "Correlation-ID", enabling this setting will make Cinnamon scan the MDC keys and normalize incorrect casing when it occurs.

        Specified by:
        normalize in interface LogCorrelation
        Returns:
        true if the correlation identifier key name should be normalised