java.util.logging

Class 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
voidclose()
Forces any data that may have been buffered to the underlying output device, but does not close System.err.
voidpublish(LogRecord record)
Publishes a LogRecord to the console, provided the record passes all tests for being loggable.

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.

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.

Parameters: record the log event to be published.