Class ConsoleHandler

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, FlushableCloseable

public class ConsoleHandler extends OutputStreamHandler
A console handler which writes to System.out by default.
  • Constructor Details

    • ConsoleHandler

      public ConsoleHandler()
      Construct a new instance.
    • ConsoleHandler

      public ConsoleHandler(Formatter formatter)
      Construct a new instance.
      Parameters:
      formatter - the formatter to use
    • ConsoleHandler

      public ConsoleHandler(ConsoleHandler.Target target)
      Construct a new instance.
      Parameters:
      target - the target to write to, or null to start with an uninitialized target
    • ConsoleHandler

      public ConsoleHandler(ConsoleHandler.Target target, Formatter formatter)
      Construct a new instance.
      Parameters:
      target - the target to write to, or null to start with an uninitialized target
      formatter - the formatter to use
  • Method Details

    • setTarget

      public void setTarget(ConsoleHandler.Target target)
      Set the target for this console handler.
      Parameters:
      target - the target to write to, or null to clear the target
    • setErrorManager

      public void setErrorManager(ErrorManager em)
      Overrides:
      setErrorManager in class ExtHandler
    • getLocalErrorManager

      public ErrorManager getLocalErrorManager()
      Get the local error manager. This is an error manager that will publish errors to this console handler. The console handler itself should not use this error manager.
      Returns:
      the local error manager
    • setOutputStream

      public void setOutputStream(OutputStream outputStream)
      Set the output stream to write to. The output stream will then belong to this handler; when the handler is closed or a new writer or output stream is set, this output stream will be closed.
      Overrides:
      setOutputStream in class OutputStreamHandler
      Parameters:
      outputStream - the new output stream or null for none