Class RequestContextExportingAppender
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
com.linecorp.armeria.common.logback.RequestContextExportingAppender
- All Implemented Interfaces:
ch.qos.logback.core.Appender<ILoggingEvent>
,ch.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
,ch.qos.logback.core.spi.ContextAware
,ch.qos.logback.core.spi.FilterAttachable<ILoggingEvent>
,ch.qos.logback.core.spi.LifeCycle
public final class RequestContextExportingAppender
extends ch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
implements ch.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
A Logback
Appender
that exports the properties of the current
RequestContext
to MDC
.
Read 'Logging contextual information' for more information.
-
Field Summary
Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
name, started
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAppender(ch.qos.logback.core.Appender<ILoggingEvent> newAppender)
void
addAttribute(String alias, AttributeKey<?> attrKey)
Adds the specifiedAttributeKey
to the export list.void
addAttribute(String alias, AttributeKey<?> attrKey, Function<?,String> stringifier)
Adds the specifiedAttributeKey
to the export list.void
addBuiltIn(BuiltInProperty property)
Adds the specifiedBuiltInProperty
to the export list.void
addRequestHeader(CharSequence name)
Adds the specified HTTP request header name to the export list.void
addResponseHeader(CharSequence name)
Adds the specified HTTP response header name to the export list.protected void
append(ILoggingEvent eventObject)
void
boolean
detachAppender(ch.qos.logback.core.Appender<ILoggingEvent> appender)
boolean
detachAppender(String name)
ch.qos.logback.core.Appender<ILoggingEvent>
getAppender(String name)
boolean
isAttached(ch.qos.logback.core.Appender<ILoggingEvent> appender)
Iterator<ch.qos.logback.core.Appender<ILoggingEvent>>
void
Adds the property represented by the specified MDC key to the export list.void
setExportGroup(ExportGroupConfig exportGroupConfiguration)
Adds the export group.void
setExports(String mdcKeys)
Adds the properties represented by the specified comma-separated MDC keys to the export list.void
Specifies a prefix of the default export group.void
start()
void
stop()
Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
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, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
RequestContextExportingAppender
public RequestContextExportingAppender()
-
-
Method Details
-
addBuiltIn
Adds the specifiedBuiltInProperty
to the export list. -
addAttribute
Adds the specifiedAttributeKey
to the export list.- Parameters:
alias
- the alias of the attribute to exportattrKey
- the key of the attribute to export
-
addAttribute
Adds the specifiedAttributeKey
to the export list. -
addRequestHeader
Adds the specified HTTP request header name to the export list. -
addResponseHeader
Adds the specified HTTP response header name to the export list. -
setPrefix
Specifies a prefix of the default export group. Note: this method is meant to be used for XML configuration. -
setExport
Adds the property represented by the specified MDC key to the export list. Note: this method is meant to be used for XML configuration. Useadd*()
methods instead. -
setExports
Adds the properties represented by the specified comma-separated MDC keys to the export list. Note: this method is meant to be used for XML configuration. Useadd*()
methods instead. -
setExportGroup
Adds the export group. Note: this method is meant to be used for XML configuration. -
append
- Specified by:
append
in classch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
-
start
public void start()- Specified by:
start
in interfacech.qos.logback.core.spi.LifeCycle
- Overrides:
start
in classch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
-
stop
public void stop()- Specified by:
stop
in interfacech.qos.logback.core.spi.LifeCycle
- Overrides:
stop
in classch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
-
addAppender
- Specified by:
addAppender
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
iteratorForAppenders
- Specified by:
iteratorForAppenders
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
getAppender
- Specified by:
getAppender
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
isAttached
- Specified by:
isAttached
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
detachAndStopAllAppenders
public void detachAndStopAllAppenders()- Specified by:
detachAndStopAllAppenders
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
detachAppender
- Specified by:
detachAppender
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
detachAppender
- Specified by:
detachAppender
in interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-