Package org.apache.logging.log4j.io
Class LoggerOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.logging.log4j.io.LoggerOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class LoggerOutputStream extends java.io.OutputStreamLogs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface that follows theOutputStreammethods in spirit, but doesn't require output to any external stream. This class should not be used as a stream for an underlying logger unless it's being used as a bridge. Otherwise, infinite loops may occur!- Since:
- 2.1
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringFQCNprivate InternalOutputStreamlogger
-
Constructor Summary
Constructors Modifier Constructor Description protectedLoggerOutputStream(ExtendedLogger logger, Level level, Marker marker, java.nio.charset.Charset charset, java.lang.String fqcn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Field Detail
-
FQCN
private static final java.lang.String FQCN
-
logger
private final InternalOutputStream logger
-
-
Constructor Detail
-
LoggerOutputStream
protected LoggerOutputStream(ExtendedLogger logger, Level level, Marker marker, java.nio.charset.Charset charset, java.lang.String fqcn)
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
-