Package org.apache.log.output.io.rotate
Class RotateStrategyByTimeOfDay
java.lang.Object
org.apache.log.output.io.rotate.RotateStrategyByTimeOfDay
- All Implemented Interfaces:
RotateStrategy
Rotation stragety based on a specific time of day.
- Author:
- Leif Mortenson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
Time in ms that the current rotation started.private static final long
Constant that stores the the number of ms in 24 hours. -
Constructor Summary
ConstructorsConstructorDescriptionRotate logs at specific time of day.RotateStrategyByTimeOfDay
(long time) Rotate logs at specific time of day. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isRotationNeeded
(String data, File file) Check if now a log rotation is neccessary.void
reset()
reset interval history counters.
-
Field Details
-
TIME_24_HOURS
private static final long TIME_24_HOURSConstant that stores the the number of ms in 24 hours.- See Also:
-
m_currentRotation
private long m_currentRotationTime in ms that the current rotation started.
-
-
Constructor Details
-
RotateStrategyByTimeOfDay
public RotateStrategyByTimeOfDay()Rotate logs at specific time of day. By default do log rotation at 00:00:00 every day. -
RotateStrategyByTimeOfDay
public RotateStrategyByTimeOfDay(long time) Rotate logs at specific time of day.- Parameters:
time
- Offset in milliseconds into the day to perform the log rotation.
-
-
Method Details
-
reset
public void reset()reset interval history counters.- Specified by:
reset
in interfaceRotateStrategy
-
isRotationNeeded
Check if now a log rotation is neccessary. If the time of the current rotation + 24 hours is less than the current time. If not then a rotation is needed.- Specified by:
isRotationNeeded
in interfaceRotateStrategy
- Parameters:
data
- the last message written to the log systemfile
- not used- Returns:
- boolean return true if log rotation is neccessary, else false
-