Package com.lightbend.cinnamon.slf4j.mdc
Class AutomaticCorrelationId
- java.lang.Object
-
- com.lightbend.cinnamon.slf4j.mdc.AutomaticCorrelationId
-
- All Implemented Interfaces:
LogCorrelation
public class AutomaticCorrelationId extends java.lang.Object implements LogCorrelation
Automatically generate random correlation identifiers at entry points.
-
-
Constructor Summary
Constructors Constructor Description AutomaticCorrelationId(com.typesafe.config.Config config)
-
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.
-
-
-
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 interfaceLogCorrelation
- 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 interfaceLogCorrelation
- 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 interfaceLogCorrelation
- 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 interfaceLogCorrelation
- Returns:
- true if the correlation identifier key name should be normalised
-
-