Package io.debezium.junit.logging
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLogInterceptor()Constructor using root logger.LogInterceptor(Class<?> clazz)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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappend(ch.qos.logback.classic.spi.ILoggingEvent loggingEvent)booleancontainsErrorMessage(String text)private booleancontainsMessage(ch.qos.logback.classic.Level level, String text)booleancontainsMessage(String text)booleancontainsStacktraceElement(String text)booleancontainsWarnMessage(String text)longcountOccurrences(String text)voidsetLoggerLevel(Class<?> loggerClass, String 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
-
-
-
-
Field Detail
-
events
private List<ch.qos.logback.classic.spi.ILoggingEvent> events
-
-
Constructor Detail
-
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 Detail
-
append
protected void append(ch.qos.logback.classic.spi.ILoggingEvent loggingEvent)
- Specified by:
appendin classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
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)
-
containsMessage
private boolean containsMessage(ch.qos.logback.classic.Level level, String text)
-
-