- java.lang.Object
-
- java.util.logging.Handler
-
- java.util.logging.StreamHandler
-
- org.jorigin.logging.LogHandler
-
public class LogHandler extends StreamHandler
This class is a convenience rewriting ofConsoleHandlerclass. Its provide a more flexible management of logging.- Since:
- 1.0.0
- Version:
- "1.0.13" - b202005081200L
- Author:
- Julien Seinturier - COMEX S.A. - contact@jorigin.org - https://github.com/jorigin/jeometry
-
-
Constructor Summary
Constructors Constructor Description LogHandler()Create 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()OverrideStreamHandler.close()to do a flush but not to close the output stream.voidpublish(LogRecord record)Publish 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, setOutputStream
-
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
-
-
-
-
Constructor Detail
-
LogHandler
public LogHandler()
Create a Log Handler forSystem.out.
-
LogHandler
public LogHandler(OutputStream output)
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
public LogHandler(OutputStream output, Level level)
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 Detail
-
publish
public void publish(LogRecord record)
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
-
-