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.appender.v1_0.OpenTelemetryAppender
All Implemented Interfaces:
ch.qos.logback.core.Appender<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>
  • 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    append(ch.qos.logback.classic.spi.ILoggingEvent event)
     
    void
    setCaptureCodeAttributes(boolean captureCodeAttributes)
    Sets whether the code attributes (file name, class name, method name and line number) should be set to logs.
    void
    setCaptureExperimentalAttributes(boolean captureExperimentalAttributes)
    Sets whether experimental attributes should be set to logs.
    void
    setCaptureMarkerAttribute(boolean captureMarkerAttribute)
    Sets whether the marker attribute should be set to logs.
    void
    Configures the MDC attributes that will be copied to logs.
    void
     

    Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase

    addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, stop, 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

    • OpenTelemetryAppender

      public OpenTelemetryAppender()
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface ch.qos.logback.core.spi.LifeCycle
      Overrides:
      start in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • append

      protected void append(ch.qos.logback.classic.spi.ILoggingEvent event)
      Specified by:
      append in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • setCaptureExperimentalAttributes

      public void setCaptureExperimentalAttributes(boolean captureExperimentalAttributes)
      Sets whether experimental attributes should be set to logs. These attributes may be changed or removed in the future, so only enable this if you know you do not require attributes filled by this instrumentation to be stable across versions.
    • setCaptureCodeAttributes

      public void setCaptureCodeAttributes(boolean captureCodeAttributes)
      Sets whether the code attributes (file name, class name, method name and line number) should be set to logs. Enabling these attributes can potentially impact performance (see https://logback.qos.ch/manual/layouts.html).
      Parameters:
      captureCodeAttributes - To enable or disable the code attributes (file name, class name, method name and line number)
    • setCaptureMarkerAttribute

      public void setCaptureMarkerAttribute(boolean captureMarkerAttribute)
      Sets whether the marker attribute should be set to logs.
      Parameters:
      captureMarkerAttribute - To enable or disable the marker attribute
    • setCaptureMdcAttributes

      public void setCaptureMdcAttributes(String attributes)
      Configures the MDC attributes that will be copied to logs.