java.util.logging
public class ConsoleHandler extends StreamHandler
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.
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.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.
|
StreamHandler
that publishes
log records to System.err
. The initial
configuration is determined by the LogManager
properties described above.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.
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.