org.apache.log.output.io.rotate
Class RotateStrategyByTimeOfDay

java.lang.Object
  extended byorg.apache.log.output.io.rotate.RotateStrategyByTimeOfDay
All Implemented Interfaces:
RotateStrategy

public class RotateStrategyByTimeOfDay
extends java.lang.Object
implements RotateStrategy

Rotation stragety based on a specific time of day.

Author:
Leif Mortenson

Constructor Summary
RotateStrategyByTimeOfDay()
          Rotate logs at specific time of day.
RotateStrategyByTimeOfDay(long time)
          Rotate logs at specific time of day.
 
Method Summary
 boolean isRotationNeeded(java.lang.String data, java.io.File file)
          Check if now a log rotation is neccessary.
 void reset()
          reset interval history counters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

reset

public void reset()
reset interval history counters.

Specified by:
reset in interface RotateStrategy

isRotationNeeded

public boolean isRotationNeeded(java.lang.String data,
                                java.io.File file)
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 interface RotateStrategy
Parameters:
data - the last message written to the log system
file - not used
Returns:
boolean return true if log rotation is neccessary, else false


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.