Class AsyncQueueFullPolicyFactory
- java.lang.Object
-
- org.apache.logging.log4j.core.async.AsyncQueueFullPolicyFactory
-
public class AsyncQueueFullPolicyFactory extends Object
CreatesAsyncQueueFullPolicy
instances based on user-specified system properties. TheAsyncQueueFullPolicy
created by this factory is used in AsyncLogger, AsyncLoggerConfig and AsyncAppender to control if events are logged in the current thread, the background thread, or discarded.Property
"log4j2.AsyncQueueFullPolicy"
controls the routing behaviour. If this property is not specified or has value"Default"
, this factory createsDefaultAsyncQueueFullPolicy
objects.If this property has value
"Discard"
, this factory createsDiscardingAsyncQueueFullPolicy
objects. By default, this router discards events of levelINFO
,DEBUG
andTRACE
if the queue is full. This can be adjusted with property"log4j2.DiscardThreshold"
(name of the level at which to start discarding).For any other value, this factory interprets the value as the fully qualified name of a class implementing the
AsyncQueueFullPolicy
interface. The class must have a default constructor.- Since:
- 2.6
-
-
Constructor Summary
Constructors Constructor Description AsyncQueueFullPolicyFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AsyncQueueFullPolicy
create()
Creates and returnsAsyncQueueFullPolicy
instances based on user-specified system properties.
-
-
-
Method Detail
-
create
public static AsyncQueueFullPolicy create()
Creates and returnsAsyncQueueFullPolicy
instances based on user-specified system properties.Property
"log4j2.AsyncQueueFullPolicy"
controls the routing behaviour. If this property is not specified or has value"Default"
, this method returnsDefaultAsyncQueueFullPolicy
objects.If this property has value
"Discard"
, this method returnsDiscardingAsyncQueueFullPolicy
objects.For any other value, this method interprets the value as the fully qualified name of a class implementing the
AsyncQueueFullPolicy
interface. The class must have a default constructor.- Returns:
- a new AsyncQueueFullPolicy
-
-