java.lang.Object
java.util.logging.Handler
java.util.logging.StreamHandler
org.jorigin.logging.LogHandler
This class is a convenience rewriting of
ConsoleHandler class.
Its provide a more flexible management of logging.- Since:
- 1.0.0
- Version:
- "1.0.14" - b202111241200L
- Author:
- Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a Log Handler forSystem.out.LogHandler(OutputStream output) Create a Log Handler that publish its records to the givenoutputLogHandler(OutputStream output, Level level) Create a Log Handler that publish its records to the givenoutput. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()OverrideStreamHandler.close()to do a flush but not to close the output stream.voidPublish alog record.
The logging request was made initially to a Logger object, which initialized thelog recordand forwarded it here.Methods inherited from class java.util.logging.StreamHandler
flush, isLoggable, setEncoding, setOutputStreamMethods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
-
Constructor Details
-
LogHandler
public LogHandler()Create a Log Handler forSystem.out. -
LogHandler
Create a Log Handler that publish its records to the givenoutput- Parameters:
output- the output stream where the records capted by this handler are published.
-
LogHandler
Create a Log Handler that publish its records to the givenoutput. The record level is given by parameterlevel- Parameters:
output- the output stream where the records capted by this handler are published.level- the level of the publihed records.
-
-
Method Details
-
publish
Publish alog record.
The logging request was made initially to a Logger object, which initialized thelog recordand forwarded it here.- Overrides:
publishin classStreamHandler- Parameters:
record- description of the log event. A null record is silently ignored and is not published
-
close
public void close()OverrideStreamHandler.close()to do a flush but not to close the output stream. That is, we do not closeSystem.err.- Overrides:
closein classStreamHandler
-