Syslog White Paper FAQ Examples JavaDoc Classloader
Protomatter Software v1.1.7

com.protomatter.syslog
Class TimeRolloverLog

java.lang.Object
  |
  +--com.protomatter.syslog.BasicLogger
        |
        +--com.protomatter.syslog.TimeRolloverLog
All Implemented Interfaces:
Syslogger

public class TimeRolloverLog
extends BasicLogger

An implementation of an object that will log things using the Syslog facility, and roll it's log files after a certain amount of time has passed.

See Also:
XML configuration class

Field Summary
static int ROLL_DAILY
          Roll logs at midnight.
static int ROLL_HOURLY
          Roll logs on the hour.
static int ROLL_MINUTELY
          Roll logs on the minute.
static int ROLL_MONTHLY
          Roll logs at midnight at the end of the month.
 
Fields inherited from class com.protomatter.syslog.BasicLogger
formatter, policy, realPolicy
 
Constructor Summary
TimeRolloverLog()
          You must call the configure() method to configure this logger if you use this constructor.
TimeRolloverLog(java.lang.String basename, int roll, java.lang.String extension)
          Write log information to the given log, roll when specified.
TimeRolloverLog(java.lang.String basename, java.lang.String extension, int roll, java.lang.String nameformat, boolean append, boolean autoFlush)
          Write log information to the given log, roll when specified.
 
Method Summary
 void flush()
          Flush the given logger's output.
 boolean getAppend()
          Determine if we will append to files that already exist.
 boolean getAutoFlush()
          Determine if we will automatically flush the writer.
 java.lang.String getBaseFilename()
          Get the base name for the log file.
 java.io.File getCurrentFile()
          Get the file currently being written to.
 java.lang.String getFileExtension()
          Get the file extension to use.
 java.lang.String getNameFormat()
          Get the dateformat part of the name.
 java.util.Date getNextRolloverTime()
          Calculate the next date to rollover the logs based on how often we should roll.
 java.io.File getPreviousFile()
          Get the file we were writing to before we rolled.
 int getRollType()
          Get the roll type.
 void log(SyslogMessage message)
          Log an entry to the log.
 void rollover(java.util.Date d)
          Roll the logs.
 void setAppend(boolean append)
          Set if we will append to files that already exist.
 void setAutoFlush(boolean flush)
          Should we will automatically flush the writer?
 void setBaseFilename(java.lang.String basename)
          Set the base name for the log file.
 void setFileExtension(java.lang.String extension)
          Set the file extension to use.
 void setNameFormat(java.lang.String fmt)
          Set the dateformat part of the name.
 void setRollType(int type)
          Set the roll type.
 void shutdown()
          Cleanup and prepare for shutdown.
 
Methods inherited from class com.protomatter.syslog.BasicLogger
formatLogEntry, getName, getPolicy, getTextFormatter, isSuspended, mightLog, resetDateFormat, resume, setName, setPolicy, setTextFormatter, shouldLog, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLL_MINUTELY

public static int ROLL_MINUTELY
Roll logs on the minute.

ROLL_HOURLY

public static int ROLL_HOURLY
Roll logs on the hour.

ROLL_DAILY

public static int ROLL_DAILY
Roll logs at midnight.

ROLL_MONTHLY

public static int ROLL_MONTHLY
Roll logs at midnight at the end of the month.
Constructor Detail

TimeRolloverLog

public TimeRolloverLog(java.lang.String basename,
                       int roll,
                       java.lang.String extension)
Write log information to the given log, roll when specified. The file written to will actually be "basenamedate" where date is the date formatted as "yyyy.MM.dd-HH.mm.ss"

TimeRolloverLog

public TimeRolloverLog(java.lang.String basename,
                       java.lang.String extension,
                       int roll,
                       java.lang.String nameformat,
                       boolean append,
                       boolean autoFlush)
Write log information to the given log, roll when specified. The file written to will actually be "basenamedateextension" where date is the date formatted using the given nameformat.

TimeRolloverLog

public TimeRolloverLog()
You must call the configure() method to configure this logger if you use this constructor.
Method Detail

getRollType

public int getRollType()
Get the roll type.

setRollType

public void setRollType(int type)
Set the roll type.

getBaseFilename

public java.lang.String getBaseFilename()
Get the base name for the log file.

setBaseFilename

public void setBaseFilename(java.lang.String basename)
Set the base name for the log file.

getFileExtension

public java.lang.String getFileExtension()
Get the file extension to use.

setFileExtension

public void setFileExtension(java.lang.String extension)
Set the file extension to use.

setAppend

public void setAppend(boolean append)
Set if we will append to files that already exist.

getAppend

public boolean getAppend()
Determine if we will append to files that already exist.

getAutoFlush

public boolean getAutoFlush()
Determine if we will automatically flush the writer.

setAutoFlush

public void setAutoFlush(boolean flush)
Should we will automatically flush the writer?

getPreviousFile

public java.io.File getPreviousFile()
Get the file we were writing to before we rolled.

getCurrentFile

public java.io.File getCurrentFile()
Get the file currently being written to.

rollover

public void rollover(java.util.Date d)
Roll the logs. This should only be called by configuration helpers.

setNameFormat

public void setNameFormat(java.lang.String fmt)
Set the dateformat part of the name.

getNameFormat

public java.lang.String getNameFormat()
Get the dateformat part of the name.

log

public final void log(SyslogMessage message)
Description copied from interface: Syslogger
Log an entry to the log.

getNextRolloverTime

public java.util.Date getNextRolloverTime()
Calculate the next date to rollover the logs based on how often we should roll.

shutdown

public void shutdown()
Cleanup and prepare for shutdown.

flush

public void flush()
Description copied from interface: Syslogger
Flush the given logger's output.

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7