org.apache.logging.log4j.io
Class LoggerOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.logging.log4j.io.LoggerOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class LoggerOutputStream
extends OutputStream

Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface that follows the OutputStream methods 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

Constructor Summary
protected LoggerOutputStream(org.apache.logging.log4j.spi.ExtendedLogger logger, org.apache.logging.log4j.Level level, org.apache.logging.log4j.Marker marker, Charset charset, String fqcn)
           
 
Method Summary
 void close()
           
 void flush()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerOutputStream

protected LoggerOutputStream(org.apache.logging.log4j.spi.ExtendedLogger logger,
                             org.apache.logging.log4j.Level level,
                             org.apache.logging.log4j.Marker marker,
                             Charset charset,
                             String fqcn)
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.