org.apache.logging.log4j.core.appender.rolling
Class OnStartupTriggeringPolicy
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.OnStartupTriggeringPolicy
- All Implemented Interfaces:
- TriggeringPolicy
@Plugin(name="OnStartupTriggeringPolicy",
category="Core",
printObject=true)
public class OnStartupTriggeringPolicy
- extends Object
- implements TriggeringPolicy
Triggers a rollover on every restart. The target file's timestamp is compared with the JVM start time
and if it is older isTriggeringEvent will return true. After isTriggeringEvent has been called it will
always return false.
OnStartupTriggeringPolicy
public OnStartupTriggeringPolicy()
initialize
public void initialize(RollingFileManager manager)
- Provide the RollingFileManager to the policy.
- Specified by:
initialize
in interface TriggeringPolicy
- Parameters:
manager
- The RollingFileManager.
isTriggeringEvent
public boolean isTriggeringEvent(LogEvent event)
- Determine if a rollover should be triggered.
- Specified by:
isTriggeringEvent
in interface TriggeringPolicy
- Parameters:
event
- A reference to the current event.
- Returns:
- true if the target file's timestamp is older than the JVM start time.
toString
public String toString()
- Overrides:
toString
in class Object
createPolicy
@PluginFactory
public static OnStartupTriggeringPolicy createPolicy()
Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.