Package java.util.logging
Class ConsoleHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- java.util.logging.StreamHandler
-
- java.util.logging.ConsoleHandler
-
public class ConsoleHandler extends StreamHandler
A handler that writes log messages to the standard output streamSystem.err.This handler reads the following properties from the log manager to initialize itself:
- java.util.logging.ConsoleHandler.level specifies the logging level,
defaults to
Level.INFOif this property is not found or has an invalid value. - java.util.logging.ConsoleHandler.filter specifies the name of the filter
class to be associated with this handler, defaults to
nullif this property is not found or has an invalid value. - java.util.logging.ConsoleHandler.formatter specifies the name of the
formatter class to be associated with this handler, defaults to
java.util.logging.SimpleFormatterif this property is not found or has an invalid value. - java.util.logging.ConsoleHandler.encoding specifies the encoding this
handler will use to encode log messages, defaults to
nullif this property is not found or has an invalid value.
This class is not thread-safe.
- java.util.logging.ConsoleHandler.level specifies the logging level,
defaults to
-
-
Constructor Summary
Constructors Constructor Description ConsoleHandler()Constructs aConsoleHandlerobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this handler.voidpublish(LogRecord record)Logs a record if necessary.-
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
-
-
-
-
Method Detail
-
close
public void close()
Closes this handler. TheSystem.erris flushed but not closed.- Overrides:
closein classStreamHandler
-
publish
public void publish(LogRecord record)
Logs a record if necessary. A flush operation will be done.- Overrides:
publishin classStreamHandler- Parameters:
record- the log record to be logged.
-
-