to.etc.util
Class RotatingLogfile

java.lang.Object
  extended by to.etc.util.StandardLogfile
      extended by to.etc.util.RotatingLogfile
All Implemented Interfaces:
ILogSink

public class RotatingLogfile
extends StandardLogfile

Encapsulates a rotating logfile. It contains methods to write log records to a file; the file will rotate to a new name every day round midnight. By default it will clear out files older than 7 days when rotating. Before using the logfile you MUST have called setName, or you must have used the constructor which passed a name. The name is the full path to a logfile including a filename. The system will insert a date part BEFORE the filename extension for every logfile generated. So when entering a name like /var/log/serverinfo/mailer.log a generated name could be something like /var/log/serverinfo/mailer2001-12-31.log

Author:
Frits Jalvingh

Constructor Summary
RotatingLogfile()
           
RotatingLogfile(java.lang.String name)
           
 
Method Summary
protected  java.util.Date checkCycle()
          Checks to see if the log must be opened/rotated.
 void setFile(java.io.File f)
          Sets a new file as the logfile.
 
Methods inherited from class to.etc.util.StandardLogfile
exception, flush, getFile, getName, getOutWriter, log, rawlog, setName, setOutWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RotatingLogfile

public RotatingLogfile()

RotatingLogfile

public RotatingLogfile(java.lang.String name)
Method Detail

checkCycle

protected java.util.Date checkCycle()
Checks to see if the log must be opened/rotated. The log is opened when the printwriter is null; it gets rotated if the day number from the calendar changes.

Overrides:
checkCycle in class StandardLogfile
Returns:

setFile

public void setFile(java.io.File f)
Description copied from class: StandardLogfile
Sets a new file as the logfile. If the logging was open the old file is closed and the new one opened.

Overrides:
setFile in class StandardLogfile