public class MdcJsonProvider extends AbstractFieldJsonProvider<ch.qos.logback.classic.spi.ILoggingEvent> implements FieldNamesAware<LogstashFieldNames>
MDC properties in the JSON output according to
includeMdcKeyNames and excludeMdcKeyNames.
There are three valid combinations of includeMdcKeyNames
and excludeMdcKeyNames:
includeMdcKeyNames and excludeMdcKeyNames
are both empty, then all entries will be included.includeMdcKeyNames is not empty and
excludeMdcKeyNames is empty, then only those entries
with key names in includeMdcKeyNames will be included.includeMdcKeyNames is empty and
excludeMdcKeyNames is not empty, then all entries except those
with key names in excludeMdcKeyNames will be included.includeMdcKeyNames
and excludeMdcKeyNames to be not empty.
If the fieldName is set, then the properties will be written to that field as a subobject. Otherwise, the properties are written inline.
| Constructor and Description |
|---|
MdcJsonProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
addExcludeMdcKeyName(String excludedMdcKeyName) |
void |
addIncludeMdcKeyName(String includedMdcKeyName) |
List<String> |
getExcludeMdcKeyNames() |
List<String> |
getIncludeMdcKeyNames() |
void |
setExcludeMdcKeyNames(List<String> excludeMdcKeyNames) |
void |
setFieldNames(LogstashFieldNames fieldNames) |
void |
setIncludeMdcKeyNames(List<String> includeMdcKeyNames) |
void |
start() |
void |
writeTo(com.fasterxml.jackson.core.JsonGenerator generator,
ch.qos.logback.classic.spi.ILoggingEvent event)
Writes information about the event,
to the given generator.
|
getFieldName, setFieldNameisStarted, prepareForDeferredProcessing, stopaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextpublic void start()
start in interface ch.qos.logback.core.spi.LifeCyclestart in class AbstractJsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>public void writeTo(com.fasterxml.jackson.core.JsonGenerator generator,
ch.qos.logback.classic.spi.ILoggingEvent event)
throws IOException
JsonProviderwriteTo in interface JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>IOExceptionpublic void setFieldNames(LogstashFieldNames fieldNames)
setFieldNames in interface FieldNamesAware<LogstashFieldNames>public void addIncludeMdcKeyName(String includedMdcKeyName)
public void addExcludeMdcKeyName(String excludedMdcKeyName)
Copyright © 2018. All rights reserved.