ch.qos.logback.classic.sift
Class ContextBasedDiscriminator
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.classic.sift.ContextBasedDiscriminator
- All Implemented Interfaces:
- Discriminator<ILoggingEvent>, ContextAware, LifeCycle
public class ContextBasedDiscriminator
- extends ContextAwareBase
- implements Discriminator<ILoggingEvent>
This discriminator returns the value context to which this event is attached
to. If the said value is null, then a default value is returned.
Both Key and the DefaultValue are user specified properties.
- Author:
- Ceki Gülcü
Method Summary |
java.lang.String |
getDefaultValue()
|
java.lang.String |
getDiscriminatingValue(ILoggingEvent event)
Return the name of the current context name as found in the logging event. |
java.lang.String |
getKey()
The key or variable name under which the discriminating value should be
exported into the host environment. |
boolean |
isStarted()
|
void |
setDefaultValue(java.lang.String defaultValue)
The default context name in case the context name is not set for the
current logging event. |
void |
setKey(java.lang.String key)
|
void |
start()
|
void |
stop()
|
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextBasedDiscriminator
public ContextBasedDiscriminator()
getDiscriminatingValue
public java.lang.String getDiscriminatingValue(ILoggingEvent event)
- Return the name of the current context name as found in the logging event.
- Specified by:
getDiscriminatingValue
in interface Discriminator<ILoggingEvent>
- Returns:
isStarted
public boolean isStarted()
- Specified by:
isStarted
in interface LifeCycle
start
public void start()
- Specified by:
start
in interface LifeCycle
stop
public void stop()
- Specified by:
stop
in interface LifeCycle
getKey
public java.lang.String getKey()
- Description copied from interface:
Discriminator
- The key or variable name under which the discriminating value should be
exported into the host environment.
- Specified by:
getKey
in interface Discriminator<ILoggingEvent>
- Returns:
setKey
public void setKey(java.lang.String key)
getDefaultValue
public java.lang.String getDefaultValue()
- Returns:
- See Also:
setDefaultValue(String)
setDefaultValue
public void setDefaultValue(java.lang.String defaultValue)
- The default context name in case the context name is not set for the
current logging event.
- Parameters:
defaultValue
-