|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.apache.log.util.LoggerOutputStream
public class LoggerOutputStream
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 );
| Field Summary | |
|---|---|
private boolean |
m_closed
|
private Logger |
m_logger
|
private java.lang.StringBuffer |
m_output
|
private Priority |
m_priority
|
| Constructor Summary | |
|---|---|
LoggerOutputStream(Logger logger,
Priority priority)
Construct OutputStreamLogger to write to a particular logger at a particular priority. |
|
| Method Summary | |
|---|---|
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. |
| 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 |
|---|
private final Logger m_logger
private final Priority m_priority
private final java.lang.StringBuffer m_output
private boolean m_closed
| Constructor Detail |
|---|
public LoggerOutputStream(Logger logger,
Priority priority)
logger - the logger to write topriority - the priority at which to log| Method Detail |
|---|
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException - if an error occurs while closing the stream
public void write(int data)
throws java.io.IOException
write in class java.io.OutputStreamdata - the byte of data
java.io.IOException - if an error occurs
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException - if an error occurs
private void checkValid()
throws java.io.IOException
java.io.IOException - if an error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||