org.apache.avalon.framework.logger
public abstract class LoggerAwareOutputStream extends OutputStream
Extend to specify the log method that the message should be invoked. eg:
setOutputStream( new LoggerAwareOutputStream( getLogger() ) { protected void logMessage( String message ) { if ( m_logger.isDebugEnabled() ) { m_logger.debug( message ); } } } );
Since: Nov 19, 2004 7:03:50 PM
Version: $Revision:$
Field Summary | |
---|---|
ByteArrayOutputStream | bos Message buffer |
protected Logger | m_logger Logger reference |
Constructor Summary | |
---|---|
LoggerAwareOutputStream(Logger logger)
Constructor, creates instance of class.
|
Method Summary | |
---|---|
void | close()
Purposely flushes the stream, but doesn't close anything since the logger
is managed by another class.
|
void | flush()
Flushes this output stream, writing any buffered content to the log
|
protected abstract void | logMessage(String message)
Writes the message to the log. |
void | write(int b)
Writes a byte to the internal buffer. |
Parameters: logger logger this output stream should use
Throws: IOException if an IO error occurs
See Also: java.io.OutputStream#close()
Throws: IOException on error
See Also: java.io.OutputStream#flush()
Parameters: message message to be written
Parameters: b character to write
Throws: IOException if an error occurs
See Also: java.io.OutputStream#write(int)