Class Logger.FilenameLoggerTarget
java.lang.Object
|
+--Logger.FilenameLoggerTarget
- All Implemented Interfaces:
- Logger.LoggerTarget
- Enclosing class:
- Logger
- public static class Logger.FilenameLoggerTarget
- extends java.lang.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.
Method Summary |
java.lang.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(java.lang.String strFilename)
Set the filename to write log entries to. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Logger.FilenameLoggerTarget
public Logger.FilenameLoggerTarget(java.lang.String strFilename)
- Constructor.
- Parameters:
strFileName
- The filename to write log entries to.- Throws:
Exceptions
- None.
setFilename
public void setFilename(java.lang.String strFilename)
- Set the filename to write log entries to. If null, no logging to a
file is performed.
- Parameters:
strFilename
- The new filename.- Returns:
- None.
- Throws:
Exceptions
- None.
getFilename
public java.lang.String getFilename()
- Get the filename that messages are currently being logged to.
- Returns:
- The filename.
- Throws:
Exceptions
- None.
log
public void log(Logger.Entry entry)
throws java.io.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.- Returns:
- None.
- Throws:
java.io.IOException
-