Class TimeBasedTriggeringPolicy
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.appender.rolling.AbstractTriggeringPolicy
org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy
- All Implemented Interfaces:
TriggeringPolicy
,LifeCycle
,LifeCycle2
@Plugin(name="TimeBasedTriggeringPolicy",
category="Core",
printObject=true)
public final class TimeBasedTriggeringPolicy
extends AbstractTriggeringPolicy
Rolls a file over based on time.
-
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic TimeBasedTriggeringPolicy
createPolicy
(String interval, String modulate) Deprecated.int
long
void
initialize
(RollingFileManager aManager) Initializes the policy.boolean
isTriggeringEvent
(LogEvent event) Determines whether a rollover should occur.toString()
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, stop
-
Method Details
-
getInterval
public int getInterval() -
getNextRolloverMillis
public long getNextRolloverMillis() -
initialize
Initializes the policy.- Parameters:
aManager
- The RollingFileManager.
-
isTriggeringEvent
Determines whether a rollover should occur.- Parameters:
event
- A reference to the currently event.- Returns:
- true if a rollover should occur.
-
createPolicy
@Deprecated public static TimeBasedTriggeringPolicy createPolicy(@PluginAttribute("interval") String interval, @PluginAttribute("modulate") String modulate) Deprecated.UsenewBuilder()
.Creates a TimeBasedTriggeringPolicy.- Parameters:
interval
- The interval between rollovers.modulate
- If true the time will be rounded to occur on a boundary aligned with the increment.- Returns:
- a TimeBasedTriggeringPolicy.
-
newBuilder
-
toString
-
newBuilder()
.