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

public Class RotateStrategyByTime

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

rotation stragety based when log writting started.
Author
Bernhard Huber

Field Summary

Modifier and TypeField and Description
private long
private long
private long

Constructor Summary

AccessConstructor and Description
public
RotateStrategyByTime()

Rotate logs by time.

public
RotateStrategyByTime(final long
rotate before time-interval [ms] has expired
timeInterval
)

Rotate logs by time.

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
m_startingTimeback to summary
private long m_startingTime
m_timeIntervalback to summary
private long m_timeInterval

Constructor Detail

RotateStrategyByTimeback to summary
public RotateStrategyByTime()

Rotate logs by time. By default do log rotation every 24 hours

RotateStrategyByTimeback to summary
public RotateStrategyByTime(final long timeInterval)

Rotate logs by time.

Parameters
timeInterval:long

rotate before time-interval [ms] has expired

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 (current_time - m_startingTime) / m_timeInterval > m_currentRotation 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.