java.lang.Object | +--java.util.logging.Handler | +--java.util.logging.StreamHandler | +--java.util.logging.ConsoleHandler
ConsoleHandler() Constructs a |
void | close() Forces any data that may have been buffered to the underlying
output device, but does not close |
void | publish(java.util.logging.LogRecord record) Publishes a |
public ConsoleHandler()
StreamHandler
that publishes
log records to System.err
. The initial
configuration is determined by the LogManager
properties described above.
public void 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.
public void publish(java.util.logging.LogRecord record)
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.
record
- the log event to be published.
ConsoleHandler
publishes log records toSystem.err
.Configuration: Values of the subsequent
LogManager
properties are taken into consideration when aConsoleHandler
is initialized. If a property is not defined, or if it has an invalid value, a default is taken without an exception being thrown.java.util.logging.ConsoleHandler.level
- specifies the initial severity level threshold. Default value:Level.INFO
.java.util.logging.ConsoleHandler.filter
- specifies the name of a Filter class. Default value: No Filter.java.util.logging.ConsoleHandler.formatter
- specifies the name of a Formatter class. Default value:java.util.logging.SimpleFormatter
.java.util.logging.ConsoleHandler.encoding
- specifies the name of the character encoding. Default value: the default platform encoding.