com.bristle.javalib.log
Class Logger.FilenameLoggerTarget

java.lang.Object
  extended by com.bristle.javalib.log.Logger.FilenameLoggerTarget
All Implemented Interfaces:
Logger.LoggerTarget
Enclosing class:
Logger

public static class Logger.FilenameLoggerTarget
extends Object
implements Logger.LoggerTarget

This class implements the LoggerTarget interface, writing log entries to a named text file. It is a simple example of a LoggerTarget that is used by the Tester class below, and can also be used by clients outside of the Logger class.


Constructor Summary
Logger.FilenameLoggerTarget(String strFilename)
          Constructor.
 
Method Summary
 String getFilename()
          Get the filename that messages are currently being logged to.
 void log(Logger.Entry entry)
          Log the log entry to the file.
 void setFilename(String strFilename)
          Set the filename to write log entries to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Logger.FilenameLoggerTarget

public Logger.FilenameLoggerTarget(String strFilename)
Constructor.

Parameters:
strFilename - The filename to write log entries to.
Method Detail

setFilename

public void setFilename(String strFilename)
Set the filename to write log entries to. If null, no logging to a file is performed.

Parameters:
strFilename - The new filename.

getFilename

public String getFilename()
Get the filename that messages are currently being logged to.

Returns:
The filename.

log

public void log(Logger.Entry entry)
         throws IOException
Log the log entry to the file.

Specified by:
log in interface Logger.LoggerTarget
Parameters:
entry - The log entry to write to the log.
Throws:
IOException - When an error occurs writing the log file.