|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.apache.avalon.framework.logger.LoggerAwareOutputStream
public abstract class LoggerAwareOutputStream
Logger aware output stream, characters written to this OutputStream
are buffered until a newline character is encountered, or a flush() is called.
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 ); } } } );
Field Summary | |
---|---|
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. |
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 |
Field Detail |
---|
protected final Logger m_logger
Logger
reference
Constructor Detail |
---|
public LoggerAwareOutputStream(Logger logger)
logger
- logger this output stream should useMethod Detail |
---|
public void write(int b) throws IOException
write
in class OutputStream
b
- character to write
IOException
- if an error occursOutputStream.write(int)
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- on errorOutputStream.flush()
public void close() throws IOException
close
in interface Closeable
close
in class OutputStream
IOException
- if an IO error occursOutputStream.close()
protected abstract void logMessage(String message)
message
- message to be written
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |