Class 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean consoleLogging
      Flag to enable console logging.
      private java.io.Writer writer
      A writer to write log records with.
      private java.lang.Object writerLock
      Lock for the writer.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultHandler​(boolean consoleLogging, java.io.Writer writer)
      The constructor to use.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
    • Field Detail

      • writerLock

        private final java.lang.Object writerLock
        Lock for the writer.
      • writer

        private java.io.Writer writer
        A writer to write log records with.
      • consoleLogging

        private final boolean consoleLogging
        Flag to enable console logging.
    • Constructor Detail

      • DefaultHandler

        public DefaultHandler​(boolean consoleLogging,
                              java.io.Writer writer)
        The constructor to use.
        Parameters:
        consoleLogging - The flag to log to the console as well.
        writer - The Writer to use for logging.
    • Method Detail

      • 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 LogRecord to publish.