Top Description Fields Constructors Methods
org.apache.log.output.io.rotate

public Class RotateStrategyByTimeOfDay

extends Object
implements RotateStrategy
Class Inheritance
All Implemented Interfaces
org.apache.log.output.io.rotate.RotateStrategy
Imports
java.io.File, java.util.Calendar, .GregorianCalendar

Rotation stragety based on a specific time of day.
Author
Leif Mortenson

Field Summary

Modifier and TypeField and Description
private long
m_currentRotation

Time in ms that the current rotation started.

private static final long
TIME_24_HOURS

Constant that stores the the number of ms in 24 hours.

Constructor Summary

AccessConstructor and Description
public
RotateStrategyByTimeOfDay()

Rotate logs at specific time of day.

public
RotateStrategyByTimeOfDay(final long
Offset in milliseconds into the day to perform the log rotation.
time
)

Rotate logs at specific time of day.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

boolean return true if log rotation is neccessary, else false
isRotationNeeded
(final String
the last message written to the log system
data
,
final File
not used
file
)

Implements org.apache.log.output.io.rotate.RotateStrategy.isRotationNeeded.

Check if now a log rotation is neccessary.
public void
reset()

Implements org.apache.log.output.io.rotate.RotateStrategy.reset.

reset interval history counters.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_currentRotationback to summary
private long m_currentRotation

Time in ms that the current rotation started.

TIME_24_HOURSback to summary
private static final long TIME_24_HOURS

Constant that stores the the number of ms in 24 hours.

Constructor Detail

RotateStrategyByTimeOfDayback to summary
public RotateStrategyByTimeOfDay()

Rotate logs at specific time of day. By default do log rotation at 00:00:00 every day.

RotateStrategyByTimeOfDayback to summary
public RotateStrategyByTimeOfDay(final long time)

Rotate logs at specific time of day.

Parameters
time:long

Offset in milliseconds into the day to perform the log rotation.

Method Detail

isRotationNeededback to summary
public boolean isRotationNeeded(final String data, final File file)

Implements org.apache.log.output.io.rotate.RotateStrategy.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.

Parameters
data:String

the last message written to the log system

file:File

not used

Returns:boolean

boolean return true if log rotation is neccessary, else false

resetback to summary
public void reset()

Implements org.apache.log.output.io.rotate.RotateStrategy.reset.

reset interval history counters.