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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicLongdiscardCountprivate static LoggerLOGGERprivate LevelthresholdLevel
-
Constructor Summary
Constructors Constructor Description DiscardingAsyncQueueFullPolicy(Level thresholdLevel)Constructs a router that will discard events equal or less specific than the specified threshold level when the queue is full.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static longgetDiscardCount(AsyncQueueFullPolicy router)EventRoutegetRoute(long backgroundThreadId, Level level)Returns the appropriate route for the current log event, given the specified parameters.LevelgetThresholdLevel()
-
-
-
Constructor Detail
-
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 Detail
-
getRoute
public EventRoute getRoute(long backgroundThreadId, Level level)
Description copied from interface:AsyncQueueFullPolicyReturns the appropriate route for the current log event, given the specified parameters.- Specified by:
getRoutein interfaceAsyncQueueFullPolicy- Overrides:
getRoutein classDefaultAsyncQueueFullPolicy- 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()
-
-