Wildfire 3.2.4 Javadoc

org.jivesoftware.util.log.util
Class LoggerOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jivesoftware.util.log.util.LoggerOutputStream
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
OutputStreamLogger

public class LoggerOutputStream
extends OutputStream

Redirect an output stream to a logger. This class is useful to redirect standard output or standard error to a Logger. An example use is

 final LoggerOutputStream outputStream =
     new LoggerOutputStream( logger, Priority.DEBUG );
 final PrintStream output = new PrintStream( outputStream, true );
 

System.setOut( output );

Author:
Peter Donald

Constructor Summary
LoggerOutputStream(Logger logger, Priority priority)
          Construct OutputStreamLogger to send to a particular logger at a particular priority.
 
Method Summary
 void close()
          Shutdown stream.
 void flush()
          Flush data to underlying logger.
 void write(int data)
          Write a single byte of data to output stream.
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerOutputStream

public LoggerOutputStream(Logger logger,
                          Priority priority)
Construct OutputStreamLogger to send to a particular logger at a particular priority.

Parameters:
logger - the logger to send to
priority - the priority at which to log
Method Detail

close

public void close()
           throws IOException
Shutdown stream.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

write

public void write(int data)
           throws IOException
Write a single byte of data to output stream.

Specified by:
write in class OutputStream
Parameters:
data - the byte of data
Throws:
IOException - if an error occurs

flush

public void flush()
           throws IOException
Flush data to underlying logger.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException - if an error occurs

Wildfire 3.2.4 Javadoc

Copyright © 2003-2007 Jive Software.