org.apache.logging.log4j.core.filter
Class TimeFilter
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilter
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 classes/interfaces inherited from interface org.apache.logging.log4j.core.Filter |
Filter.Result |
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle |
getState, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop |
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.