Class Loki4jAppender

  • 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 Loki4jAppender
    extends PipelineConfigAppenderBase
    Main appender that provides functionality for sending log record batches to Loki. This class is responsible for converting Logback event to internal log record representation and sending it to the pipeline.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DISABLE_SMD_PATTERN  
      • 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
      Loki4jAppender()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void append​(ch.qos.logback.classic.spi.ILoggingEvent event)  
      LogRecord eventToLogRecord​(ch.qos.logback.classic.spi.ILoggingEvent event)  
      void setLabels​(java.lang.String labelsPattern)  
      void setMessage​(ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> messageLayout)  
      void setReadMarkers​(boolean readMarkers)  
      void setStructuredMetadata​(java.lang.String structuredMetadataPattern)  
      void setVerbose​(boolean verbose)  
      void start()  
      void stop()  
      • Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase

        addFilter, buildReentryGuard, 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
    • Field Detail

      • DISABLE_SMD_PATTERN

        public static final java.lang.String DISABLE_SMD_PATTERN
        See Also:
        Constant Field Values
    • Constructor Detail

      • Loki4jAppender

        public Loki4jAppender()
    • Method Detail

      • 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>
      • stop

        public void stop()
        Specified by:
        stop in interface ch.qos.logback.core.spi.LifeCycle
        Overrides:
        stop 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>
      • eventToLogRecord

        public LogRecord eventToLogRecord​(ch.qos.logback.classic.spi.ILoggingEvent event)
      • setLabels

        public void setLabels​(java.lang.String labelsPattern)
      • setStructuredMetadata

        public void setStructuredMetadata​(java.lang.String structuredMetadataPattern)
      • setMessage

        public void setMessage​(ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> messageLayout)
      • setReadMarkers

        public void setReadMarkers​(boolean readMarkers)
      • setVerbose

        public void setVerbose​(boolean verbose)