Package org.apache.log.output.io.rotate
Class RotateStrategyByTime
- java.lang.Object
-
- org.apache.log.output.io.rotate.RotateStrategyByTime
-
- All Implemented Interfaces:
RotateStrategy
public class RotateStrategyByTime extends java.lang.Object implements RotateStrategy
rotation stragety based when log writting started.
-
-
Field Summary
Fields Modifier and Type Field Description private long
m_currentRotation
private long
m_startingTime
private long
m_timeInterval
-
Constructor Summary
Constructors Constructor Description RotateStrategyByTime()
Rotate logs by time.RotateStrategyByTime(long timeInterval)
Rotate logs by time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isRotationNeeded(java.lang.String data, java.io.File file)
Check if now a log rotation is neccessary.void
reset()
reset interval history counters.
-
-
-
Method Detail
-
reset
public void reset()
reset interval history counters.- Specified by:
reset
in interfaceRotateStrategy
-
isRotationNeeded
public boolean isRotationNeeded(java.lang.String data, java.io.File file)
Check if now a log rotation is neccessary. If(current_time - m_startingTime) / m_timeInterval > m_currentRotation
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
-
-