Class SizeBasedTriggeringPolicy
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.appender.rolling.AbstractTriggeringPolicy
org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy
- All Implemented Interfaces:
TriggeringPolicy
,LifeCycle
,LifeCycle2
@Plugin(name="SizeBasedTriggeringPolicy",
category="Core",
printObject=true)
public class SizeBasedTriggeringPolicy
extends AbstractTriggeringPolicy
-
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
ModifierConstructorDescriptionprotected
Constructs a new instance.protected
SizeBasedTriggeringPolicy
(long maxFileSize) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic SizeBasedTriggeringPolicy
createPolicy
(String size) Create a SizeBasedTriggeringPolicy.long
void
initialize
(RollingFileManager aManager) Initialize the TriggeringPolicy.boolean
isTriggeringEvent
(LogEvent event) Returns true if 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
-
Constructor Details
-
SizeBasedTriggeringPolicy
protected SizeBasedTriggeringPolicy()Constructs a new instance. -
SizeBasedTriggeringPolicy
protected SizeBasedTriggeringPolicy(long maxFileSize) Constructs a new instance.- Parameters:
maxFileSize
- rollover threshold size in bytes.
-
-
Method Details
-
getMaxFileSize
public long getMaxFileSize() -
initialize
Initialize the TriggeringPolicy.- Parameters:
aManager
- The RollingFileManager.
-
isTriggeringEvent
Returns true if a rollover should occur.- Parameters:
event
- A reference to the currently event.- Returns:
- true if a rollover should take place, false otherwise.
-
toString
-
createPolicy
@PluginFactory public static SizeBasedTriggeringPolicy createPolicy(@PluginAttribute("size") String size) Create a SizeBasedTriggeringPolicy.- Parameters:
size
- The size of the file before rollover is required.- Returns:
- A SizeBasedTriggeringPolicy.
-