Package com.metsci.glimpse.util.logging
Class LoggerUtils.LoggingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- com.metsci.glimpse.util.logging.LoggerUtils.LoggingOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Enclosing class:
- LoggerUtils
public static class LoggerUtils.LoggingOutputStream extends ByteArrayOutputStream
An OutputStream that writes contents to a Logger upon each call to flush() Original URL: https://blogs.oracle.com/nickstephen/entry/java_redirecting_system_out_and Author gives permission for free use in blog comments section.
-
-
Constructor Summary
Constructors Constructor Description LoggingOutputStream(Logger logger, Level level)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()upon flush() write the existing contents of the OutputStream to the logger as a log record.-
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Method Detail
-
flush
public void flush() throws IOExceptionupon flush() write the existing contents of the OutputStream to the logger as a log record.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- in case of error
-
-