org.apache.logging.log4j.core.filter
Class TimeFilter

java.lang.Object
  extended by org.apache.logging.log4j.core.AbstractLifeCycle
      extended by org.apache.logging.log4j.core.filter.AbstractFilter
          extended by org.apache.logging.log4j.core.filter.TimeFilter
All Implemented Interfaces:
Serializable, Filter, LifeCycle

@Plugin(name="TimeFilter",
        category="Core",
        elementType="filter",
        printObject=true)
public final class TimeFilter
extends AbstractFilter

Filters events that fall within a specified time period in each day.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.Filter
Filter.Result
 
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.filter.AbstractFilter
onMatch, onMismatch
 
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
LOGGER
 
Fields inherited from interface org.apache.logging.log4j.core.Filter
ELEMENT_TYPE
 
Method Summary
static TimeFilter createFilter(String start, String end, String tz, Filter.Result match, Filter.Result mismatch)
          Create a TimeFilter.
 Filter.Result filter(LogEvent event)
          Context Filter method.
 String toString()
           
 
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
equalsImpl, filter, filter, filter, getOnMatch, getOnMismatch, hashCodeImpl
 
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
getState, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, isStarted, isStopped, start, stop
 

Method Detail

filter

public Filter.Result filter(LogEvent event)
Description copied from class: AbstractFilter
Context Filter method. The default returns NEUTRAL.

Specified by:
filter in interface Filter
Overrides:
filter in class AbstractFilter
Parameters:
event - The LogEvent.
Returns:
The Result of filtering.

toString

public String toString()
Overrides:
toString in class AbstractFilter

createFilter

@PluginFactory
public static TimeFilter createFilter(@PluginAttribute(value="start")
                                                    String start,
                                                    @PluginAttribute(value="end")
                                                    String end,
                                                    @PluginAttribute(value="timezone")
                                                    String tz,
                                                    @PluginAttribute(value="onMatch")
                                                    Filter.Result match,
                                                    @PluginAttribute(value="onMismatch")
                                                    Filter.Result mismatch)
Create a TimeFilter.

Parameters:
start - The start time.
end - The end time.
tz - timezone.
match - Action to perform if the time matches.
mismatch - Action to perform if the action does not match.
Returns:
A TimeFilter.


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.