Class AsyncAppenderBase<E>

  • Type Parameters:
    E -
    All Implemented Interfaces:
    Appender<E>, AppenderAttachable<E>, ContextAware, FilterAttachable<E>, LifeCycle
    Direct Known Subclasses:

    public class AsyncAppenderBase<E>
    extends UnsynchronizedAppenderBase<E>
    implements AppenderAttachable<E>
    This appender and derived classes, log events asynchronously. In order to avoid loss of logging events, this appender should be closed. It is the user's responsibility to close appenders, typically at the end of the application lifecycle.

    This appender buffers events in a BlockingQueue. AsyncAppenderBase.Worker thread created by this appender takes events from the head of the queue, and dispatches them to the single appender attached to this appender.

    Please refer to the logback manual for further information about this appender.

    • Field Detail


        public static final int DEFAULT_QUEUE_SIZE
        The default buffer size.
        See Also:
        Constant Field Values

        public static final int DEFAULT_MAX_FLUSH_TIME
        The default maximum queue flush time allowed during appender stop. If the worker takes longer than this time it will exit, discarding any remaining items in the queue
        See Also:
        Constant Field Values
    • Constructor Detail

      • AsyncAppenderBase

        public AsyncAppenderBase()
    • Method Detail

      • getQueueSize

        public int getQueueSize()
      • setQueueSize

        public void setQueueSize​(int queueSize)
      • getDiscardingThreshold

        public int getDiscardingThreshold()
      • setDiscardingThreshold

        public void setDiscardingThreshold​(int discardingThreshold)
      • getMaxFlushTime

        public int getMaxFlushTime()
      • setMaxFlushTime

        public void setMaxFlushTime​(int maxFlushTime)
      • getNumberOfElementsInQueue

        public int getNumberOfElementsInQueue()
        Returns the number of elements currently in the blocking queue.
        number of elements currently in the queue.
      • setNeverBlock

        public void setNeverBlock​(boolean neverBlock)
      • isNeverBlock

        public boolean isNeverBlock()
      • getRemainingCapacity

        public int getRemainingCapacity()
        The remaining capacity available in the blocking queue.
        the remaining capacity