org.milyn.util
Class StdoutToLog4jFilter
java.lang.Object
java.io.Writer
java.io.FilterWriter
org.milyn.util.StdoutToLog4jFilter
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
public class StdoutToLog4jFilter
- extends FilterWriter
StoutToLog4jFilter is just a simple FileWriter implementation that
supresses output unless the log4j priority is set to debug.
This class in indended to be used with hsql embedded server and to
be used like this:
Log targetLogger = LogFactory.getLog("org.hsqldb");
server.setLogWriter(new PrintWriter(new StdoutToLog4jFilter(server.getLogWriter(), targetLogger)));
- Author:
- Daniel Bevenius
|
Field Summary |
protected org.apache.commons.logging.Log |
logger
Log to log check logging level. |
protected StringBuilder |
sb
string "buffer" |
logger
protected org.apache.commons.logging.Log logger
- Log to log check logging level.
sb
protected StringBuilder sb
- string "buffer"
StdoutToLog4jFilter
public StdoutToLog4jFilter(Writer writer)
StdoutToLog4jFilter
public StdoutToLog4jFilter(Writer writer,
org.apache.commons.logging.Log log)
write
public void write(int c)
throws IOException
- Overrides:
write in class FilterWriter
- Throws:
IOException
write
public void write(char[] cbuf,
int off,
int len)
throws IOException
- Overrides:
write in class FilterWriter
- Throws:
IOException
write
public void write(String str,
int off,
int len)
throws IOException
- Overrides:
write in class FilterWriter
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush in interface Flushable- Overrides:
flush in class FilterWriter
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Overrides:
close in class FilterWriter
- Throws:
IOException
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize in class Object
- Throws:
Throwable
log
protected void log()
stripExtraNewLine
protected final void stripExtraNewLine()
Copyright © 2018. All rights reserved.