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.
  • Constructor Details

    • AbstractFilterable

      protected AbstractFilterable()
    • AbstractFilterable

      protected AbstractFilterable(Filter filter)
    • AbstractFilterable

      protected AbstractFilterable(Filter filter, Property[] propertyArray)
      Since:
      2.11.2
  • Method Details

    • addFilter

      public void addFilter(Filter filter)
      Adds a filter.
      Specified by:
      addFilter in interface Filterable
      Parameters:
      filter - The Filter to add.
    • getFilter

      public Filter getFilter()
      Returns the Filter.
      Specified by:
      getFilter in interface Filterable
      Returns:
      the Filter or null.
    • hasFilter

      public boolean hasFilter()
      Determines if a Filter is present.
      Specified by:
      hasFilter in interface Filterable
      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 interface Filterable
      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 interface Filterable
      Parameters:
      filter - The Filter to remove.
    • start

      public void start()
      Make the Filter available for use.
      Specified by:
      start in interface LifeCycle
      Overrides:
      start in class AbstractLifeCycle
    • stop

      public boolean stop(long timeout, TimeUnit timeUnit)
      Cleanup the Filter.
      Specified by:
      stop in interface LifeCycle2
      Overrides:
      stop in class AbstractLifeCycle
      Parameters:
      timeout - the maximum time to wait
      timeUnit - 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()