Class LogHandler


public class LogHandler extends StreamHandler
This class is a convenience rewriting of ConsoleHandler class. Its provide a more flexible management of logging.
Since:
1.0.0
Version:
"1.0.14" - b202111241200L
Author:
Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
  • Constructor Details

    • LogHandler

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

      public LogHandler(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(OutputStream output, 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 Details

    • publish

      public void publish(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 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 StreamHandler