Class DiscardingAsyncQueueFullPolicy

java.lang.Object
org.apache.logging.log4j.core.async.DefaultAsyncQueueFullPolicy
org.apache.logging.log4j.core.async.DiscardingAsyncQueueFullPolicy
All Implemented Interfaces:
AsyncQueueFullPolicy

public class DiscardingAsyncQueueFullPolicy extends DefaultAsyncQueueFullPolicy
Discarding router extends the DefaultAsyncQueueFullPolicy by first verifying if the queue is fuller than the specified threshold ratio; if this is the case, log events more specific than the specified threshold level are dropped. If this is not the case, the default routing rules hold.
  • Constructor Details

    • DiscardingAsyncQueueFullPolicy

      public DiscardingAsyncQueueFullPolicy(Level thresholdLevel)
      Constructs a router that will discard events equal or less specific than the specified threshold level when the queue is full.
      Parameters:
      thresholdLevel - level of events to discard
  • Method Details

    • getRoute

      public EventRoute getRoute(long backgroundThreadId, Level level)
      Description copied from interface: AsyncQueueFullPolicy
      Returns the appropriate route for the current log event, given the specified parameters.
      Specified by:
      getRoute in interface AsyncQueueFullPolicy
      Overrides:
      getRoute in class DefaultAsyncQueueFullPolicy
      Parameters:
      backgroundThreadId - the thread ID of the background thread. Can be compared with the current thread's ID.
      level - the level of the log event
      Returns:
      the appropriate route for the current event
    • getDiscardCount

      public static long getDiscardCount(AsyncQueueFullPolicy router)
    • getThresholdLevel

      public Level getThresholdLevel()