Class LoggingSystemTurboFilter
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.classic.turbo.TurboFilter
com.inductiveautomation.ignition.common.logging.LoggingSystemTurboFilter
- All Implemented Interfaces:
ch.qos.logback.core.spi.ContextAware
,ch.qos.logback.core.spi.LifeCycle
public class LoggingSystemTurboFilter
extends ch.qos.logback.classic.turbo.TurboFilter
This is our main filter in the logging system. A LogBack TurboFilter is one
that is consulted before a log event is generated, for every logging event in
the system (so it must be fast!). It has the ability to deny an event before
it's generated, or bypass the rest of the filters and automatically accept
it.
Our implementation here is focused on the functionality we add around MDC values. It has the ability to filter based on mdc values, or to emulate logger levels, but for MDC key/values instead of logger names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
We can do 2 things: 1) set levels for specific property values (which bypass/ignore logger levels) 2) set property filters, so that events only pass when the property matches. -
Field Summary
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clear()
void
ch.qos.logback.core.spi.FilterReply
This gets called 2 times- one as an actual turbofilter, in which case strict=false, and we only care about promoting events.ch.qos.logback.core.spi.FilterReply
decide
(org.slf4j.Marker marker, ch.qos.logback.classic.Logger logger, ch.qos.logback.classic.Level level, String format, Object[] params, Throwable t) protected LoggingSystemTurboFilter.MDCKeyFilter
getOrCreate
(String key) Returns the full set of key filters currently applied, in a map with Key Name -> Value Name -> Level hierarchyvoid
removeFilter
(String key, String value) void
boolean
wasAcceptedBy
(ch.qos.logback.classic.spi.ILoggingEvent event) Methods inherited from class ch.qos.logback.classic.turbo.TurboFilter
getName, isStarted, setName, start, stop
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
Constructor Details
-
LoggingSystemTurboFilter
public LoggingSystemTurboFilter()
-
-
Method Details
-
keyFilterValues
Returns the full set of key filters currently applied, in a map with Key Name -> Value Name -> Level hierarchy- Returns:
- map of currently active filters, its values, and the
Level
of the value
-
clear
public void clear() -
getOrCreate
-
setLevel
-
clearLevels
public void clearLevels() -
addFilter
-
removeFilter
-
decide
public ch.qos.logback.core.spi.FilterReply decide(org.slf4j.Marker marker, ch.qos.logback.classic.Logger logger, ch.qos.logback.classic.Level level, String format, Object[] params, Throwable t) - Specified by:
decide
in classch.qos.logback.classic.turbo.TurboFilter
-
wasAcceptedBy
public boolean wasAcceptedBy(ch.qos.logback.classic.spi.ILoggingEvent event) -
decide
public ch.qos.logback.core.spi.FilterReply decide(Map<String, String> mdcMap, ch.qos.logback.classic.Level level, boolean strict) This gets called 2 times- one as an actual turbofilter, in which case strict=false, and we only care about promoting events. Then, when strict is true, we're trying to decide what appender hte message should go on. In that case, we must match exactly.
-