net.sf.freecol.common.logging
Class DefaultHandler
java.lang.Object
java.util.logging.Handler
net.sf.freecol.common.logging.DefaultHandler
public final class DefaultHandler
- extends java.util.logging.Handler
The default handler for FreeCol's log records. It currently only
logs to a file in the format offered by TextFormatter.
|
Constructor Summary |
DefaultHandler(boolean consoleLogging,
java.lang.String fileName)
The constructor to use. |
|
Method Summary |
void |
close()
Closes this handler so that it will stop handling log records. |
void |
flush()
Flushes the data that this handler has logged. |
void |
publish(java.util.logging.LogRecord record)
Publishes the given LogRecord by writing its data to a file using a
TextFormatter. |
| Methods inherited from class java.util.logging.Handler |
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fileWriter
private java.io.FileWriter fileWriter
consoleLogging
private final boolean consoleLogging
DefaultHandler
public DefaultHandler(boolean consoleLogging,
java.lang.String fileName)
throws FreeColException
- The constructor to use.
- Parameters:
consoleLogging - The flag to log to the console as well.
- Throws:
FreeColException - In case the log file could not be
created/written to.
close
public void close()
- Closes this handler so that it will stop handling log records.
- Specified by:
close in class java.util.logging.Handler
flush
public void flush()
- Flushes the data that this handler has logged.
- Specified by:
flush in class java.util.logging.Handler
publish
public void publish(java.util.logging.LogRecord record)
- Publishes the given LogRecord by writing its data to a file using a
TextFormatter.
- Specified by:
publish in class java.util.logging.Handler
- Parameters:
record - The log record to publish.