Class LogInterceptor

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
io.debezium.junit.logging.LogInterceptor
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 LogInterceptor extends ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
Author:
Chris Cranford, Jiri Pechanec
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private List<ch.qos.logback.classic.spi.ILoggingEvent>
     

    Fields inherited from class ch.qos.logback.core.AppenderBase

    name, started

    Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

    context
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor using root logger.
     
    Provides a log interceptor based on the logger that emits the message.
     
    LogInterceptor(String loggerName)
    Provides a log interceptor based on the logger that emits the message.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    append(ch.qos.logback.classic.spi.ILoggingEvent loggingEvent)
     
    void
     
    boolean
     
    private boolean
    containsMessage(ch.qos.logback.classic.Level level, String text)
     
    boolean
     
    boolean
     
    boolean
     
    long
     
     
    void
    setLoggerLevel(Class<?> loggerClass, ch.qos.logback.classic.Level level)
     

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

    addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, start, 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
  • Field Details

    • events

      private List<ch.qos.logback.classic.spi.ILoggingEvent> events
  • Constructor Details

    • LogInterceptor

      protected LogInterceptor()
      Constructor using root logger. This is usually not desirable as disabled additivity can prevent message to get here.
    • LogInterceptor

      public LogInterceptor(String loggerName)
      Provides a log interceptor based on the logger that emits the message.
      Parameters:
      loggerName - logger that emits the log message
    • LogInterceptor

      public LogInterceptor(Class<?> clazz)
      Provides a log interceptor based on the logger that emits the message.
      Parameters:
      clazz - class that emits the log message
  • Method Details

    • append

      protected void append(ch.qos.logback.classic.spi.ILoggingEvent loggingEvent)
      Specified by:
      append in class ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • setLoggerLevel

      public void setLoggerLevel(Class<?> loggerClass, ch.qos.logback.classic.Level level)
    • getLogEntriesThatContainsMessage

      public List<String> getLogEntriesThatContainsMessage(String text)
    • countOccurrences

      public long countOccurrences(String text)
    • containsMessage

      public boolean containsMessage(String text)
    • containsWarnMessage

      public boolean containsWarnMessage(String text)
    • containsErrorMessage

      public boolean containsErrorMessage(String text)
    • containsStacktraceElement

      public boolean containsStacktraceElement(String text)
    • clear

      public void clear()
    • containsMessage

      private boolean containsMessage(ch.qos.logback.classic.Level level, String text)