org.apache.log4j.rolling
Class CompositeTriggeringPolicy

java.lang.Object
  extended by org.apache.log4j.rolling.CompositeTriggeringPolicy
All Implemented Interfaces:
TriggeringPolicy, org.apache.log4j.spi.OptionHandler, UnrecognizedElementHandler

public final class CompositeTriggeringPolicy
extends java.lang.Object
implements TriggeringPolicy, UnrecognizedElementHandler

CompositeTriggeringPolicy determines if rolling should be triggered by evaluating the current event against a set of triggering policies. TriggeringPolicy results are OR'd together - if any of the triggering policies report rolling should occur, a rolling event will be triggered.


Constructor Summary
CompositeTriggeringPolicy()
           
 
Method Summary
 void activateOptions()
           
 void addTriggeringPolicy(TriggeringPolicy policy)
          Add triggering policy
 boolean isTriggeringEvent(org.apache.log4j.Appender appender, org.apache.log4j.spi.LoggingEvent event, java.lang.String file, long fileLength)
          Determines if a rollover may be appropriate at this time.
 boolean parseUnrecognizedElement(org.w3c.dom.Element element, java.util.Properties props)
          Called to inform a configured object when an unrecognized child element is encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeTriggeringPolicy

public CompositeTriggeringPolicy()
Method Detail

isTriggeringEvent

public boolean isTriggeringEvent(org.apache.log4j.Appender appender,
                                 org.apache.log4j.spi.LoggingEvent event,
                                 java.lang.String file,
                                 long fileLength)
Description copied from interface: TriggeringPolicy
Determines if a rollover may be appropriate at this time. If true is returned, RolloverPolicy.rollover will be called but it can determine that a rollover is not warranted.

Specified by:
isTriggeringEvent in interface TriggeringPolicy
Parameters:
appender - A reference to the appender.
event - A reference to the currently event.
file - The filename for the currently active log file.
fileLength - Length of the file in bytes.
Returns:
true if a rollover should occur.

addTriggeringPolicy

public void addTriggeringPolicy(TriggeringPolicy policy)
Add triggering policy

Parameters:
policy -

activateOptions

public void activateOptions()
Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler

parseUnrecognizedElement

public boolean parseUnrecognizedElement(org.w3c.dom.Element element,
                                        java.util.Properties props)
                                 throws java.lang.Exception
Description copied from interface: UnrecognizedElementHandler
Called to inform a configured object when an unrecognized child element is encountered.

Specified by:
parseUnrecognizedElement in interface UnrecognizedElementHandler
Parameters:
element - element, may not be null.
props - properties in force, may be null.
Returns:
true if configured object recognized the element
Throws:
java.lang.Exception - throw an exception to prevent activation of the configured object.


Copyright © 2010 The Apache Software Foundation. Licensed under the Apache License, Version 2.0

Apache Extras Companion for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.