Class AsyncBufferFullFallbackAppender
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.UnsynchronizedAppenderBase<E>
-
- ch.qos.logback.core.AsyncAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
- ch.admin.bag.covidcertificate.log.async.AsyncBufferFullFallbackAppender
-
- 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 AsyncBufferFullFallbackAppender extends ch.qos.logback.core.AsyncAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>Async appender with a reference to a fallback appender to use if the async logging event buffer is nearing capacity. Compared to theAsyncAppenderfrom logback, theAsyncBufferFullFallbackAppenderwill spill over log events to the fallback instead of blocking or discarding log events in case the buffer is nearly full.The fallback is used if less than fallbackThreshold (default: 20%) of the buffer size is available.
Typical use case: Spill over log events to a faster appender if the appender logged to by the async appender cannot keep up with the amount of logged events.
The fallback appender can be disabled using
setUseFallbackAppender(boolean), which is useful to allow for configuratively disabling the fallback mechanism via a property. In this case the appender behaves just like theAsyncAppenderfrom logback.
-
-
Constructor Summary
Constructors Constructor Description AsyncBufferFullFallbackAppender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappend(ch.qos.logback.classic.spi.ILoggingEvent eventObject)Append a log event asynchronously, falling back to the fallback appender ifgetRemainingCapacity() <= fallbackThresholdprotected voidpreprocess(ch.qos.logback.classic.spi.ILoggingEvent eventObject)voidsetFallback(FallbackAppenderRef fallback)voidsetFallbackThreshold(int fallbackThreshold)voidsetUseFallbackAppender(boolean useFallbackAppender)voidstart()voidstop()-
Methods inherited from class ch.qos.logback.core.AsyncAppenderBase
addAppender, detachAndStopAllAppenders, detachAppender, detachAppender, getAppender, getDiscardingThreshold, getMaxFlushTime, getNumberOfElementsInQueue, getQueueSize, getRemainingCapacity, isAttached, isDiscardable, isNeverBlock, iteratorForAppenders, setDiscardingThreshold, setMaxFlushTime, setNeverBlock, setQueueSize
-
Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, 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
-
-
-
-
Method Detail
-
append
protected void append(ch.qos.logback.classic.spi.ILoggingEvent eventObject)
Append a log event asynchronously, falling back to the fallback appender ifgetRemainingCapacity() <= fallbackThreshold- Overrides:
appendin classch.qos.logback.core.AsyncAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
preprocess
protected void preprocess(ch.qos.logback.classic.spi.ILoggingEvent eventObject)
- Overrides:
preprocessin classch.qos.logback.core.AsyncAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
start
public void start()
- Specified by:
startin interfacech.qos.logback.core.spi.LifeCycle- Overrides:
startin classch.qos.logback.core.AsyncAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
stop
public void stop()
- Specified by:
stopin interfacech.qos.logback.core.spi.LifeCycle- Overrides:
stopin classch.qos.logback.core.AsyncAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
setUseFallbackAppender
public void setUseFallbackAppender(boolean useFallbackAppender)
-
setFallbackThreshold
public void setFallbackThreshold(int fallbackThreshold)
-
setFallback
public void setFallback(FallbackAppenderRef fallback)
-
-