public class LoggingOutputStream
extends java.io.OutputStream
OutputStream that forwards lines written to it to
a Logger at a specified level. Bytes are accumulated by this
OutputStream until a System.lineSeparator() value is found;
once the line ending is found, the line is flushed to the logger.
Bytes written to a LoggingOutputStream instance must have been
encoded using UTF-8. This affects proper
recognition of line separators and re-assembly of logged strings.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
| Constructor and Description |
|---|
LoggingOutputStream(org.slf4j.Logger logger,
org.slf4j.event.Level level)
Creates a new
LoggingOutputStream writing to the provided logger and the
specified level. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
write(int b) |
public static final int DEFAULT_BUFFER_SIZE
public LoggingOutputStream(org.slf4j.Logger logger,
org.slf4j.event.Level level)
LoggingOutputStream writing to the provided logger and the
specified level.
Bytes written to this LoggingOutputStream must be UTF-8 encoded characters.
logger - the SLF4J Logger instance to which the stream should writelevel - the SLF4J level at which the stream is recorded to loggerpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionCopyright © 2022. All rights reserved.