to.etc.util
Class StandardLogfile

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

public class StandardLogfile
extends java.lang.Object
implements ILogSink

Non-rotating logfile implementing ILogSink.

Author:
Frits Jalvingh Created on Nov 25, 2010

Constructor Summary
StandardLogfile()
           
StandardLogfile(java.lang.String name)
           
 
Method Summary
protected  java.util.Date checkCycle()
          Called when a new line is to be logged.
 void exception(java.lang.Throwable t, java.lang.String msg)
          Logs an exception to the stream.
 void flush()
           
 java.io.File getFile()
           
 java.lang.String getName()
           
protected  java.io.PrintWriter getOutWriter()
           
 void log(java.lang.String msg)
          Logs a line to the stream.
 void rawlog(java.lang.String s)
           
 void setFile(java.io.File f)
          Sets a new file as the logfile.
 void setName(java.lang.String name)
           
protected  void setOutWriter(java.io.PrintWriter outWriter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardLogfile

public StandardLogfile()

StandardLogfile

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

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

getFile

public java.io.File getFile()

setFile

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

Parameters:
f -

checkCycle

protected java.util.Date checkCycle()
Called when a new line is to be logged. This returns a new timestamp OR null if the logfile is closed due to errors.

Returns:

setOutWriter

protected void setOutWriter(java.io.PrintWriter outWriter)
Parameters:
outWriter - The outWriter to set.

getOutWriter

protected java.io.PrintWriter getOutWriter()
Returns:
Returns the outWriter.

log

public void log(java.lang.String msg)
Logs a line to the stream.

Specified by:
log in interface ILogSink

exception

public void exception(java.lang.Throwable t,
                      java.lang.String msg)
Logs an exception to the stream.

Specified by:
exception in interface ILogSink

rawlog

public void rawlog(java.lang.String s)

flush

public void flush()