Class OpenTelemetryAppender
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
io.opentelemetry.instrumentation.logback.mdc.v1_0.OpenTelemetryAppender
- All Implemented Interfaces:
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.ContextAware,ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>,ch.qos.logback.core.spi.LifeCycle
public class OpenTelemetryAppender
extends ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
implements ch.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
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<ch.qos.logback.classic.spi.ILoggingEvent> appender) protected voidappend(ch.qos.logback.classic.spi.ILoggingEvent event) voidbooleandetachAppender(ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> appender) booleandetachAppender(String name) ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> getAppender(String name) booleanisAttached(ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> appender) Iterator<ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>> voidsetAddBaggage(boolean addBaggage) When set to true this will enable addition of all baggage entries to MDC.voidsetSpanIdKey(String spanIdKey) Customize MDC key name for the span id.voidsetTraceFlagsKey(String traceFlagsKey) Customize MDC key name for the trace flags.voidsetTraceIdKey(String traceIdKey) Customize MDC key name for the trace id.Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, start, stop, 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
-
OpenTelemetryAppender
public OpenTelemetryAppender()
-
-
Method Details
-
setAddBaggage
public void setAddBaggage(boolean addBaggage) When set to true this will enable addition of all baggage entries to MDC. This can be done by adding the following to the logback.xml config for this appender.<addBaggage>true</addBaggage>- Parameters:
addBaggage- True if baggage should be added to MDC
-
setTraceIdKey
Customize MDC key name for the trace id. -
setSpanIdKey
Customize MDC key name for the span id. -
setTraceFlagsKey
Customize MDC key name for the trace flags. -
append
protected void append(ch.qos.logback.classic.spi.ILoggingEvent event) - Specified by:
appendin classch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
addAppender
public void addAppender(ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> appender) - Specified by:
addAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
iteratorForAppenders
public Iterator<ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>> iteratorForAppenders()- Specified by:
iteratorForAppendersin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
getAppender
public ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> getAppender(String name) - Specified by:
getAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
isAttached
public boolean isAttached(ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> appender) - Specified by:
isAttachedin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
detachAndStopAllAppenders
public void detachAndStopAllAppenders()- Specified by:
detachAndStopAllAppendersin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
detachAppender
public boolean detachAppender(ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> appender) - Specified by:
detachAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-
detachAppender
- Specified by:
detachAppenderin interfacech.qos.logback.core.spi.AppenderAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
-