Class IdlePurgePolicy
- java.lang.Object
-
- org.apache.logging.log4j.core.AbstractLifeCycle
-
- org.apache.logging.log4j.core.appender.routing.IdlePurgePolicy
-
- All Implemented Interfaces:
java.lang.Runnable,PurgePolicy,LifeCycle,LifeCycle2
@Plugin(name="IdlePurgePolicy", category="Core", printObject=true) @Scheduled public class IdlePurgePolicy extends AbstractLifeCycle implements PurgePolicy, java.lang.Runnable
Policy is purging appenders that were not in use specified time in minutes
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
-
Field Summary
-
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
-
-
Constructor Summary
Constructors Constructor Description IdlePurgePolicy(long timeToLive, long checkInterval, ConfigurationScheduler scheduler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PurgePolicycreatePurgePolicy(java.lang.String timeToLive, java.lang.String checkInterval, java.lang.String timeUnit, Configuration configuration)Create the PurgePolicyvoidinitialize(RoutingAppender routingAppender)Initializes with routing appendervoidpurge()Purging appenders that were not in use specified timevoidrun()booleanstop(long timeout, java.util.concurrent.TimeUnit timeUnit)Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.java.lang.StringtoString()voidupdate(java.lang.String key, LogEvent event)-
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop
-
-
-
-
Constructor Detail
-
IdlePurgePolicy
public IdlePurgePolicy(long timeToLive, long checkInterval, ConfigurationScheduler scheduler)
-
-
Method Detail
-
initialize
public void initialize(RoutingAppender routingAppender)
Description copied from interface:PurgePolicyInitializes with routing appender- Specified by:
initializein interfacePurgePolicy
-
stop
public boolean stop(long timeout, java.util.concurrent.TimeUnit timeUnit)Description copied from interface:LifeCycle2Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
stopin interfaceLifeCycle2- Overrides:
stopin classAbstractLifeCycle- Parameters:
timeout- the maximum time to waittimeUnit- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
purge
public void purge()
Purging appenders that were not in use specified time- Specified by:
purgein interfacePurgePolicy
-
update
public void update(java.lang.String key, LogEvent event)- Specified by:
updatein interfacePurgePolicy
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
createPurgePolicy
@PluginFactory public static PurgePolicy createPurgePolicy(@PluginAttribute("timeToLive") java.lang.String timeToLive, @PluginAttribute("checkInterval") java.lang.String checkInterval, @PluginAttribute("timeUnit") java.lang.String timeUnit, @PluginConfiguration Configuration configuration)
Create the PurgePolicy- Parameters:
timeToLive- the number of increments of timeUnit before the Appender should be purged.checkInterval- when all appenders purged, the number of increments of timeUnit to check if any appenders appearedtimeUnit- the unit of time the timeToLive and the checkInterval is expressed in.- Returns:
- The Routes container.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-