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 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 long
getDiscardCount(AsyncQueueFullPolicy router)
EventRoute
getRoute(long backgroundThreadId, Level level)
Returns the appropriate route for the current log event, given the specified parameters.Level
getThresholdLevel()
-
-
-
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:AsyncQueueFullPolicy
Returns the appropriate route for the current log event, given the specified parameters.- Specified by:
getRoute
in interfaceAsyncQueueFullPolicy
- Overrides:
getRoute
in 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()
-
-