Class OnStartupTriggeringPolicy
- java.lang.Object
-
- org.apache.logging.log4j.core.AbstractLifeCycle
-
- org.apache.logging.log4j.core.appender.rolling.AbstractTriggeringPolicy
-
- org.apache.logging.log4j.core.appender.rolling.OnStartupTriggeringPolicy
-
- All Implemented Interfaces:
TriggeringPolicy
,LifeCycle
,LifeCycle2
@Plugin(name="OnStartupTriggeringPolicy", category="Core", printObject=true) public class OnStartupTriggeringPolicy extends AbstractTriggeringPolicy
Triggers a rollover on every restart, but only if the file size is greater than zero.
-
-
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OnStartupTriggeringPolicy
createPolicy(long minSize)
void
initialize(RollingFileManager manager)
Provide the RollingFileManager to the policy.boolean
isTriggeringEvent(LogEvent event)
Determine if a rollover should be triggered.String
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 Detail
-
initialize
public void initialize(RollingFileManager manager)
Provide the RollingFileManager to the policy.- Parameters:
manager
- The RollingFileManager.
-
isTriggeringEvent
public boolean isTriggeringEvent(LogEvent event)
Determine if a rollover should be triggered.- Parameters:
event
- A reference to the current event.- Returns:
- true if the target file's timestamp is older than the JVM start time.
-
createPolicy
@PluginFactory public static OnStartupTriggeringPolicy createPolicy(@PluginAttribute(value="minSize",defaultLong=1L) long minSize)
-
-