org.apache.log.util
Class LoggerOutputStream
OutputStreamorg.apache.log.util.LoggerOutputStream
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 );
private void | checkValid()- Make sure stream is valid.
|
void | close()- Shutdown stream.
|
void | flush()- Flush data to underlying logger.
|
void | write(int data)- Write a single byte of data to output stream.
|
m_closed
private boolean m_closed
m_logger
private final Logger m_logger
m_output
private final StringBuffer m_output
m_priority
private final Priority m_priority
LoggerOutputStream
public LoggerOutputStream(Logger logger,
Priority priority) Construct OutputStreamLogger to write to a particular logger at a particular priority.
logger - the logger to write topriority - the priority at which to log
checkValid
private void checkValid()
throws IOException Make sure stream is valid.
close
public void close()
throws IOException Shutdown stream.
flush
public void flush()
throws IOException Flush data to underlying logger.
write
public void write(int data)
throws IOException Write a single byte of data to output stream.