public class MDCBasedDiscriminator extends AbstractDiscriminator<ILoggingEvent>
Both Key and the DefaultValue are user specified properties.
Constructor and Description |
---|
MDCBasedDiscriminator() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDefaultValue() |
java.lang.String |
getDiscriminatingValue(ILoggingEvent event)
Return the value associated with an MDC entry designated by the Key
property.
|
java.lang.String |
getKey()
The key or variable name under which the discriminating value should be
exported into the host environment.
|
void |
setDefaultValue(java.lang.String defaultValue)
The default MDC value in case the MDC is not set for
mdcKey . |
void |
setKey(java.lang.String key) |
void |
start() |
isStarted, stop
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getStatusManager, setContext
public java.lang.String getDiscriminatingValue(ILoggingEvent event)
public void start()
start
in interface LifeCycle
start
in class AbstractDiscriminator<ILoggingEvent>
public java.lang.String getKey()
Discriminator
public void setKey(java.lang.String key)
public java.lang.String getDefaultValue()
setDefaultValue(String)
public void setDefaultValue(java.lang.String defaultValue)
mdcKey
.
For example, if Key
is set to the value
"someKey", and the MDC is not set for "someKey", then this appender will
use the default value, which you can set with the help of this method.
defaultValue
- Copyright © 2010 - 2020 Adobe. All Rights Reserved