Package org.apache.log4j.filter
Class AndFilter
- java.lang.Object
-
- org.apache.log4j.spi.Filter
-
- org.apache.log4j.filter.AndFilter
-
- All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler
,org.apache.log4j.xml.UnrecognizedElementHandler
public class AndFilter extends org.apache.log4j.spi.Filter implements org.apache.log4j.xml.UnrecognizedElementHandler
A filter that 'and's the results of any number of contained filters together. For the filter to process events, all contained filters must return Filter.ACCEPT. If the contained filters do not return Filter.ACCEPT, Filter.NEUTRAL is returned. If acceptOnMatch is set to true, Filter.ACCEPT is returned. If acceptOnMatch is set to false, Filter.DENY is returned. Here is an example config that will accept only events that contain BOTH a DEBUG level AND 'test' in the message:
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
acceptOnMatch
(package private) org.apache.log4j.spi.Filter
headFilter
(package private) org.apache.log4j.spi.Filter
tailFilter
-
Constructor Summary
Constructors Constructor Description AndFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateOptions()
void
addFilter(org.apache.log4j.spi.Filter filter)
int
decide(org.apache.log4j.spi.LoggingEvent event)
If this event does not already contain location information, evaluate the event against the expression.boolean
parseUnrecognizedElement(org.w3c.dom.Element element, java.util.Properties props)
void
setAcceptOnMatch(boolean acceptOnMatch)
-
-
-
Method Detail
-
activateOptions
public void activateOptions()
- Specified by:
activateOptions
in interfaceorg.apache.log4j.spi.OptionHandler
- Overrides:
activateOptions
in classorg.apache.log4j.spi.Filter
-
addFilter
public void addFilter(org.apache.log4j.spi.Filter filter)
-
setAcceptOnMatch
public void setAcceptOnMatch(boolean acceptOnMatch)
-
decide
public int decide(org.apache.log4j.spi.LoggingEvent event)
If this event does not already contain location information, evaluate the event against the expression. If the expression evaluates to true, generate a LocationInfo instance by creating an exception and set this LocationInfo on the event. ReturnsFilter.NEUTRAL
- Specified by:
decide
in classorg.apache.log4j.spi.Filter
-
parseUnrecognizedElement
public boolean parseUnrecognizedElement(org.w3c.dom.Element element, java.util.Properties props) throws java.lang.Exception
- Specified by:
parseUnrecognizedElement
in interfaceorg.apache.log4j.xml.UnrecognizedElementHandler
- Throws:
java.lang.Exception
-
-