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, startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAppender(ch.qos.logback.core.Appender<ILoggingEvent> newAppender)voidaddAttribute(String alias, AttributeKey<?> attrKey)Adds the specifiedAttributeKeyto the export list.voidaddAttribute(String alias, AttributeKey<?> attrKey, Function<?,String> stringifier)Adds the specifiedAttributeKeyto the export list.voidaddBuiltIn(com.linecorp.armeria.common.logging.BuiltInProperty property)Adds the specifiedBuiltInPropertyto the export list.voidaddRequestHeader(CharSequence name)Adds the specified HTTP request header name to the export list.voidaddResponseHeader(CharSequence name)Adds the specified HTTP response header name to the export list.protected voidappend(ILoggingEvent eventObject)voidbooleandetachAppender(ch.qos.logback.core.Appender<ILoggingEvent> appender)booleandetachAppender(String name)ch.qos.logback.core.Appender<ILoggingEvent>getAppender(String name)booleanisAttached(ch.qos.logback.core.Appender<ILoggingEvent> appender)Iterator<ch.qos.logback.core.Appender<ILoggingEvent>>voidAdds the property represented by the specified MDC key to the export list.voidsetExportGroup(ExportGroupConfig exportGroupConfiguration)Adds the export group.voidsetExports(String mdcKeys)Adds the properties represented by the specified comma-separated MDC keys to the export list.voidSpecifies a prefix of the default export group.voidstart()voidstop()Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
public void addBuiltIn(com.linecorp.armeria.common.logging.BuiltInProperty property)Adds the specifiedBuiltInPropertyto the export list. -
addAttribute
Adds the specifiedAttributeKeyto the export list.- Parameters:
alias- the alias of the attribute to exportattrKey- the key of the attribute to export
-
addAttribute
Adds the specifiedAttributeKeyto 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:
appendin classch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
-
start
public void start()- Specified by:
startin interfacech.qos.logback.core.spi.LifeCycle- Overrides:
startin classch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
-
stop
public void stop()- Specified by:
stopin interfacech.qos.logback.core.spi.LifeCycle- Overrides:
stopin classch.qos.logback.core.UnsynchronizedAppenderBase<ILoggingEvent>
-
addAppender
- Specified by:
addAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
iteratorForAppenders
- Specified by:
iteratorForAppendersin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
getAppender
- Specified by:
getAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
isAttached
- Specified by:
isAttachedin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
detachAndStopAllAppenders
public void detachAndStopAllAppenders()- Specified by:
detachAndStopAllAppendersin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
detachAppender
- Specified by:
detachAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-
detachAppender
- Specified by:
detachAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ILoggingEvent>
-