Package com.sun.common.util.logging
Class LoggingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- com.sun.common.util.logging.LoggingOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class LoggingOutputStream extends ByteArrayOutputStream
Implementation of a OutputStream that flush the records to a Logger. This is useful to redirect stderr and stdout to loggers. User: Jerome Dochez author: Jerome Dochez, Carla Mott
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
LoggingOutputStream.LoggingPrintStream
-
Field Summary
-
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
-
-
Constructor Summary
Constructors Constructor Description LoggingOutputStream(Logger logger, Level level)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
upon flush() write the existing contents of the OutputStream to the logger as a log record.void
log()
Retrieves the LogRecord from our Queue and log them-
Methods inherited from class java.io.ByteArrayOutputStream
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 IOException
upon flush() write the existing contents of the OutputStream to the logger as a log record.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- in case of error
-
log
public void log()
Retrieves the LogRecord from our Queue and log them
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classByteArrayOutputStream
- Throws:
IOException
-
-