java.util.logging
Class ConsoleHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by java.util.logging.StreamHandler
          extended by java.util.logging.ConsoleHandler

public class ConsoleHandler
extends StreamHandler

A ConsoleHandler publishes log records to System.err.

Configuration: Values of the subsequent LogManager properties are taken into consideration when a ConsoleHandler is initialized. If a property is not defined, or if it has an invalid value, a default is taken without an exception being thrown.


Constructor Summary
ConsoleHandler()
          Constructs a StreamHandler that publishes log records to System.err.
 
Method Summary
 void close()
          Forces any data that may have been buffered to the underlying output device, but does not close System.err.
 void publish(LogRecord record)
          Publishes a LogRecord to the console, provided the record passes all tests for being loggable.
 
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

ConsoleHandler

public ConsoleHandler()
Constructs a StreamHandler that publishes log records to System.err. The initial configuration is determined by the LogManager properties described above.

Method Detail

close

public void close()
Forces any data that may have been buffered to the underlying output device, but does not close System.err.

In case of an I/O failure, the ErrorManager of this ConsoleHandler will be informed, but the caller of this method will not receive an exception.

Overrides:
close in class StreamHandler

publish

public void publish(LogRecord record)
Publishes a LogRecord to the console, provided the record passes all tests for being loggable.

Most applications do not need to call this method directly. Instead, they will use use a Logger, which will create LogRecords and distribute them to registered handlers.

In case of an I/O failure, the ErrorManager of this SocketHandler will be informed, but the caller of this method will not receive an exception.

The GNU implementation of ConsoleHandler.publish calls flush() for every request to publish a record, so they appear immediately on the console.

Overrides:
publish in class StreamHandler
Parameters:
record - the log event to be published.