Package org.rapidcontext.util.logging
Class ConsoleHandler
java.lang.Object
java.util.logging.Handler
java.util.logging.StreamHandler
org.rapidcontext.util.logging.ConsoleHandler
A console log handler that separates output streams based on log level.
Error and warning level messages are sent to stderr, while info and lower
level messages are sent to stdout.
Configured by the following properties:
[class-name].level-- a minimum log level (Level.ALL)[class-name].filter-- an optional log filter (none)[class-name].formatter-- a log formatter (org.rapidcontext.util.logging.LogFormatter)[class-name].encoding-- an optional encoding (platform default)[class-name].stderr-level-- the minimum level for stderr output (Level.WARNING)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new log console handler using LogManager configuration properties.ConsoleHandler(Level errorLevel) Creates a new log console handler. -
Method Summary
Methods inherited from class java.util.logging.StreamHandler
isLoggable, setEncoding, setOutputStreamMethods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
-
Field Details
-
errorLevel
The minimum level for stderr output. Default is Level.WARNING.
-
-
Constructor Details
-
ConsoleHandler
public ConsoleHandler()Creates a new log console handler using LogManager configuration properties. -
ConsoleHandler
Creates a new log console handler.- Parameters:
errorLevel- the minimum level for stderr output
-
-
Method Details
-
close
Closes this handler and releases any associated resources.- Overrides:
closein classStreamHandler- Throws:
SecurityException- if logging control permission is missing
-
flush
public void flush()Flushes any buffered output.- Overrides:
flushin classStreamHandler
-
publish
Formats and publishes a log record to the appropriate output stream.- Overrides:
publishin classStreamHandler- Parameters:
record- the log entry to publish- Throws:
SecurityException- if the log stream couldn't be modified
-
setErrorStream
Sets the error output stream.- Parameters:
err- the output stream
-