Log4j 1.3alpha-8

org.apache.log4j.rolling
Class SizeBasedTriggeringPolicy

java.lang.Object
  |
  +--org.apache.log4j.rolling.SizeBasedTriggeringPolicy
All Implemented Interfaces:
OptionHandler, TriggeringPolicy

public final class SizeBasedTriggeringPolicy
extends Object
implements TriggeringPolicy, OptionHandler

SizeBasedTriggeringPolicy looks at size of the file being currently written to.

Author:
Ceki Gülcü, Curt Arnold

Constructor Summary
SizeBasedTriggeringPolicy()
          Constructs a new instance.
SizeBasedTriggeringPolicy(long maxFileSize)
          Constructs an new instance.
 
Method Summary
 void activateOptions()
          Prepares policy for use.
 long getMaxFileSize()
          Gets rollover threshold size in bytes.
 boolean isTriggeringEvent(Appender appender, LoggingEvent event, String file, long fileLength)
          {@inheritDoc}
 void setMaxFileSize(long l)
          Sets rollover threshold size in bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeBasedTriggeringPolicy

public SizeBasedTriggeringPolicy()
Constructs a new instance.

SizeBasedTriggeringPolicy

public SizeBasedTriggeringPolicy(long maxFileSize)
Constructs an new instance.
Parameters:
maxFileSize - rollover threshold size in bytes.
Method Detail

isTriggeringEvent

public boolean isTriggeringEvent(Appender appender,
                                 LoggingEvent event,
                                 String file,
                                 long fileLength)
{@inheritDoc}
Specified by:
isTriggeringEvent in interface TriggeringPolicy
Following copied from interface: org.apache.log4j.rolling.TriggeringPolicy
Parameters:
appender - A reference to the appender.
event - A reference to the currently event.
filename - The filename for the currently active log file.
fileLength - Length of the file in bytes.
Returns:
true if a rollover should occur.

getMaxFileSize

public long getMaxFileSize()
Gets rollover threshold size in bytes.
Returns:
rollover threshold size in bytes.

setMaxFileSize

public void setMaxFileSize(long l)
Sets rollover threshold size in bytes.
Parameters:
l - new value for rollover threshold size.

activateOptions

public void activateOptions()
Prepares policy for use.
Specified by:
activateOptions in interface OptionHandler

Log4j 1.3alpha-8

Copyright © 2000-2006 Apache Software Foundation.
Licensed under the Apache License, Version 2.0.