Package org.apache.log4j.filter
Class TimeFilter
- java.lang.Object
-
- org.apache.log4j.spi.Filter
-
- org.apache.log4j.filter.TimeFilter
-
- All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler
public final class TimeFilter extends org.apache.log4j.spi.Filter
Filters events that fall within a specified time period in each day.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
acceptOnMatch
private java.util.Calendar
calendar
Timezone.private long
end
Ending offset from midnight in milliseconds.private static long
HOUR_MS
Length of hour in milliseconds.private static long
MINUTE_MS
Length of minute in milliseconds.private static long
SECOND_MS
Length of second in milliseconds.private long
start
Starting offset from midnight in milliseconds.
-
Constructor Summary
Constructors Constructor Description TimeFilter()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
decide(org.apache.log4j.spi.LoggingEvent event)
boolean
getAcceptOnMatch()
Gets whether an event within the timespan should be accepted or denied.void
setAcceptOnMatch(boolean acceptOnMatch)
Sets whether an event within the timespan should be accepted or denied.void
setEnd(java.lang.String s)
Set end (exclusive) of time span.void
setStart(java.lang.String s)
Set start (inclusive) of time span.void
setTimeZone(java.lang.String s)
Set timezone.
-
-
-
Field Detail
-
acceptOnMatch
private boolean acceptOnMatch
-
start
private long start
Starting offset from midnight in milliseconds.
-
end
private long end
Ending offset from midnight in milliseconds.
-
calendar
private java.util.Calendar calendar
Timezone.
-
HOUR_MS
private static final long HOUR_MS
Length of hour in milliseconds.- See Also:
- Constant Field Values
-
MINUTE_MS
private static final long MINUTE_MS
Length of minute in milliseconds.- See Also:
- Constant Field Values
-
SECOND_MS
private static final long SECOND_MS
Length of second in milliseconds.- See Also:
- Constant Field Values
-
-
Method Detail
-
setStart
public void setStart(java.lang.String s)
Set start (inclusive) of time span.- Parameters:
s
- string representation of start time as HH:mm:ss.
-
setEnd
public void setEnd(java.lang.String s)
Set end (exclusive) of time span.- Parameters:
s
- string representation of end time as HH:mm:ss.
-
setTimeZone
public void setTimeZone(java.lang.String s)
Set timezone.- Parameters:
s
- time zone.
-
setAcceptOnMatch
public void setAcceptOnMatch(boolean acceptOnMatch)
Sets whether an event within the timespan should be accepted or denied.- Parameters:
acceptOnMatch
- true if matching event should be accepted.
-
getAcceptOnMatch
public boolean getAcceptOnMatch()
Gets whether an event within the timespan should be accepted or denied.- Returns:
- true if matching event should be accepted.
-
decide
public int decide(org.apache.log4j.spi.LoggingEvent event)
- Specified by:
decide
in classorg.apache.log4j.spi.Filter
-
-