Package org.logevents.observers
Class MdcThresholdConditionalObserver
- java.lang.Object
-
- org.logevents.observers.MdcThresholdConditionalObserver
-
- All Implemented Interfaces:
LogEventObserver
public class MdcThresholdConditionalObserver extends Object implements LogEventObserver
ALogEventObserver
that forwards all log events to a delegate observer if they have a log level equal to or more severe than theminimumThreshold
or if there is aMDC
variable on the thread which fulfills a configured logging ruleExample configuration
logger.org.example.app=INFO,DEBUG@mdc:user=superuser,admin,tester fileObserver logger.org.example.app.database=INFO,DEBUG@mdc:user=tester fileObserver
- Author:
- Johannes Brodwall
-
-
Constructor Summary
Constructors Constructor Description MdcThresholdConditionalObserver(String filter, LogEventObserver delegate)
MdcThresholdConditionalObserver(LogEventObserver delegate, Level threshold)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMdcFilter(Level level, String mdcKey, List<String> allowedValues)
LogEventObserver
filteredOn(Level level, Level configuredThreshold)
Level
getMinimumThreshold()
void
logEvent(LogEvent event)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.logevents.LogEventObserver
toList
-
-
-
-
Constructor Detail
-
MdcThresholdConditionalObserver
public MdcThresholdConditionalObserver(String filter, LogEventObserver delegate)
-
MdcThresholdConditionalObserver
public MdcThresholdConditionalObserver(LogEventObserver delegate, Level threshold)
-
-
Method Detail
-
getMinimumThreshold
public Level getMinimumThreshold()
-
logEvent
public void logEvent(LogEvent event)
- Specified by:
logEvent
in interfaceLogEventObserver
-
filteredOn
public LogEventObserver filteredOn(Level level, Level configuredThreshold)
- Specified by:
filteredOn
in interfaceLogEventObserver
-
-