Class LogHandler


  • public class LogHandler
    extends java.util.logging.StreamHandler
    This class is a convenience rewriting of ConsoleHandler class. Its provide a more flexible management of logging.
    Since:
    1.0.0
    Author:
    Julien Seinturier - (c) 2009 - JOrigin project - http:/www.jorigin.org
    • Constructor Summary

      Constructors 
      Constructor Description
      LogHandler()
      Create a Log Handler for System.out.
      LogHandler​(java.io.OutputStream output)
      Create a Log Handler that publish its records to the given output
      LogHandler​(java.io.OutputStream output, java.util.logging.Level level)
      Create a Log Handler that publish its records to the given output.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Override StreamHandler.close() to do a flush but not to close the output stream.
      void publish​(java.util.logging.LogRecord record)
      Publish a log record.
      The logging request was made initially to a Logger object, which initialized the log record and forwarded it here.
      • Methods inherited from class java.util.logging.StreamHandler

        flush, isLoggable, setEncoding, setOutputStream
      • Methods inherited from class java.util.logging.Handler

        getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogHandler

        public LogHandler()
        Create a Log Handler for System.out.
      • LogHandler

        public LogHandler​(java.io.OutputStream output)
        Create a Log Handler that publish its records to the given output
        Parameters:
        output - the output stream where the records capted by this handler are published.
      • LogHandler

        public LogHandler​(java.io.OutputStream output,
                          java.util.logging.Level level)
        Create a Log Handler that publish its records to the given output. The record level is given by parameter level
        Parameters:
        output - the output stream where the records capted by this handler are published.
        level - the level of the publihed records.
    • Method Detail

      • publish

        public void publish​(java.util.logging.LogRecord record)
        Publish a log record.
        The logging request was made initially to a Logger object, which initialized the log record and forwarded it here.
        Overrides:
        publish in class java.util.logging.StreamHandler
        Parameters:
        record - description of the log event. A null record is silently ignored and is not published
      • close

        public void close()
        Override StreamHandler.close() to do a flush but not to close the output stream. That is, we do not close System.err.
        Overrides:
        close in class java.util.logging.StreamHandler