org.apache.logging.log4j.core.appender.rolling
Class SizeBasedTriggeringPolicy

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy
All Implemented Interfaces:
TriggeringPolicy

@Plugin(name="SizeBasedTriggeringPolicy",
        category="Core",
        printObject=true)
public class SizeBasedTriggeringPolicy
extends Object
implements TriggeringPolicy


Field Summary
protected static org.apache.logging.log4j.Logger LOGGER
          Allow subclasses access to the status logger without creating another instance.
 
Constructor Summary
protected SizeBasedTriggeringPolicy()
          Constructs a new instance.
protected SizeBasedTriggeringPolicy(long maxFileSize)
          Constructs a new instance.
 
Method Summary
static SizeBasedTriggeringPolicy createPolicy(String size)
          Create a SizeBasedTriggeringPolicy.
 void initialize(RollingFileManager manager)
          Initialize the TriggeringPolicy.
 boolean isTriggeringEvent(LogEvent event)
          Returns true if a rollover should occur.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGGER

protected static final org.apache.logging.log4j.Logger LOGGER
Allow subclasses access to the status logger without creating another instance.

Constructor Detail

SizeBasedTriggeringPolicy

protected SizeBasedTriggeringPolicy()
Constructs a new instance.


SizeBasedTriggeringPolicy

protected SizeBasedTriggeringPolicy(long maxFileSize)
Constructs a new instance.

Parameters:
maxFileSize - rollover threshold size in bytes.
Method Detail

initialize

public void initialize(RollingFileManager manager)
Initialize the TriggeringPolicy.

Specified by:
initialize in interface TriggeringPolicy
Parameters:
manager - The RollingFileManager.

isTriggeringEvent

public boolean isTriggeringEvent(LogEvent event)
Returns true if a rollover should occur.

Specified by:
isTriggeringEvent in interface TriggeringPolicy
Parameters:
event - A reference to the currently event.
Returns:
true if a rollover should take place, false otherwise.

toString

public String toString()
Overrides:
toString in class Object

createPolicy

@PluginFactory
public static SizeBasedTriggeringPolicy createPolicy(@PluginAttribute(value="size")
                                                                   String size)
Create a SizeBasedTriggeringPolicy.

Parameters:
size - The size of the file before rollover is required.
Returns:
A SizeBasedTriggeringPolicy.


Copyright © 1999-2014 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.