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 classAbstractFilterable.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 Modifier and Type Field Description private FilterfilterMay be null.private Property[]propertyArray-
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFilterable()protectedAbstractFilterable(Filter filter)protectedAbstractFilterable(Filter filter, Property[] propertyArray)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFilter(Filter filter)Adds a filter.FiltergetFilter()Returns the Filter.Property[]getPropertyArray()booleanhasFilter()Determines if a Filter is present.booleanisFiltered(LogEvent event)Determine if the LogEvent should be processed or ignored.voidremoveFilter(Filter filter)Removes a Filter.voidstart()Make the Filter available for use.booleanstop(long timeout, java.util.concurrent.TimeUnit timeUnit)Cleanup the Filter.protected booleanstop(long timeout, java.util.concurrent.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
-
-
-
-
Field Detail
-
filter
private volatile Filter filter
May be null.
-
propertyArray
@PluginElement("Properties") private final Property[] propertyArray
-
-
Method Detail
-
addFilter
public void addFilter(Filter filter)
Adds a filter.- Specified by:
addFilterin interfaceFilterable- Parameters:
filter- The Filter to add.
-
getFilter
public Filter getFilter()
Returns the Filter.- Specified by:
getFilterin interfaceFilterable- Returns:
- the Filter or null.
-
hasFilter
public boolean hasFilter()
Determines if a Filter is present.- Specified by:
hasFilterin 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:
isFilteredin interfaceFilterable- Parameters:
event- The LogEvent.- Returns:
- true if the LogEvent should be processed.
-
removeFilter
public void removeFilter(Filter filter)
Removes a Filter.- Specified by:
removeFilterin interfaceFilterable- Parameters:
filter- The Filter to remove.
-
start
public void start()
Make the Filter available for use.- Specified by:
startin interfaceLifeCycle- Overrides:
startin classAbstractLifeCycle
-
stop
public boolean stop(long timeout, java.util.concurrent.TimeUnit timeUnit)Cleanup the Filter.- Specified by:
stopin interfaceLifeCycle2- Overrides:
stopin 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, java.util.concurrent.TimeUnit timeUnit, boolean changeLifeCycleState)Cleanup the Filter.
-
getPropertyArray
public Property[] getPropertyArray()
-
-