Class AbstractFilterable
- java.lang.Object
-
- org.apache.logging.log4j.core.AbstractLifeCycle
-
- org.apache.logging.log4j.core.filter.AbstractFilterable
-
- All Implemented Interfaces:
Filterable
,LifeCycle
,LifeCycle2
- Direct Known Subclasses:
AbstractAppender
,AbstractConfiguration
,AppenderControl
,LoggerConfig
public abstract class AbstractFilterable extends AbstractLifeCycle implements Filterable
Enhances a Class by allowing it to contain Filters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractFilterable.Builder<B extends AbstractFilterable.Builder<B>>
Subclasses can extend this abstract Builder.-
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
Constructors Modifier Constructor Description protected
AbstractFilterable()
protected
AbstractFilterable(Filter filter)
protected
AbstractFilterable(Filter filter, Property[] propertyArray)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFilter(Filter filter)
Adds a filter.Filter
getFilter()
Returns the Filter.Property[]
getPropertyArray()
boolean
hasFilter()
Determines if a Filter is present.boolean
isFiltered(LogEvent event)
Determine if the LogEvent should be processed or ignored.void
removeFilter(Filter filter)
Removes a Filter.void
start()
Make the Filter available for use.boolean
stop(long timeout, TimeUnit timeUnit)
Cleanup the Filter.protected boolean
stop(long timeout, TimeUnit timeUnit, boolean changeLifeCycleState)
Cleanup the Filter.-
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, stop, stop
-
-
-
-
Method Detail
-
addFilter
public void addFilter(Filter filter)
Adds a filter.- Specified by:
addFilter
in interfaceFilterable
- Parameters:
filter
- The Filter to add.
-
getFilter
public Filter getFilter()
Returns the Filter.- Specified by:
getFilter
in interfaceFilterable
- Returns:
- the Filter or null.
-
hasFilter
public boolean hasFilter()
Determines if a Filter is present.- Specified by:
hasFilter
in interfaceFilterable
- Returns:
- false if no Filter is present.
-
isFiltered
public boolean isFiltered(LogEvent event)
Determine if the LogEvent should be processed or ignored.- Specified by:
isFiltered
in interfaceFilterable
- Parameters:
event
- The LogEvent.- Returns:
- true if the LogEvent should be processed.
-
removeFilter
public void removeFilter(Filter filter)
Removes a Filter.- Specified by:
removeFilter
in interfaceFilterable
- Parameters:
filter
- The Filter to remove.
-
start
public void start()
Make the Filter available for use.- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classAbstractLifeCycle
-
stop
public boolean stop(long timeout, TimeUnit timeUnit)
Cleanup the Filter.- Specified by:
stop
in interfaceLifeCycle2
- Overrides:
stop
in classAbstractLifeCycle
- Parameters:
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
stop
protected boolean stop(long timeout, TimeUnit timeUnit, boolean changeLifeCycleState)
Cleanup the Filter.
-
getPropertyArray
public Property[] getPropertyArray()
-
-