org.mortbay.log
Class LogStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by org.mortbay.log.LogStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
LogStream.STDERR, LogStream.STDOUT

public class LogStream
extends java.io.PrintStream

Divert a PrintStream to commons logging. The stderr and stdout streams can be diverted to logs named "stderr" and "stdout" using this class.


Nested Class Summary
static class LogStream.STDERR
           
static class LogStream.STDOUT
           
 
Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
LogStream(java.lang.String tag, org.apache.commons.logging.Log log)
           
 
Method Summary
 void close()
           
 void flush()
           
static boolean getLogStdErr()
           
static boolean getLogStdOut()
           
 void println()
           
 void println(boolean arg0)
           
 void println(char arg0)
           
 void println(char[] arg0)
           
 void println(double arg0)
           
 void println(float arg0)
           
 void println(int arg0)
           
 void println(long arg0)
           
 void println(java.lang.Object arg0)
           
 void println(java.lang.String arg0)
           
static void setLogStdErr(boolean log)
          Log standard error stream.
static void setLogStdOut(boolean log)
          Log standard output stream.
 void write(byte[] arg0, int arg1, int arg2)
           
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, format, format, print, print, print, print, print, print, print, print, print, printf, printf, setError, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogStream

public LogStream(java.lang.String tag,
                 org.apache.commons.logging.Log log)
Parameters:
out -
autoflush -
Method Detail

setLogStdErr

public static void setLogStdErr(boolean log)
Log standard error stream. If set to true, output to stderr will be directed to an instance of LogStream and logged. Beware of log loops from logs that write to stderr.


getLogStdErr

public static boolean getLogStdErr()

setLogStdOut

public static void setLogStdOut(boolean log)
Log standard output stream. If set to true, output to stdout will be directed to an instance of LogStream and logged. Beware of log loops from logs that write to stdout.


getLogStdOut

public static boolean getLogStdOut()

flush

public void flush()
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.PrintStream

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.PrintStream

println

public void println()
Overrides:
println in class java.io.PrintStream

println

public void println(boolean arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(char arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(char[] arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(double arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(float arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(int arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(long arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(java.lang.Object arg0)
Overrides:
println in class java.io.PrintStream

println

public void println(java.lang.String arg0)
Overrides:
println in class java.io.PrintStream

write

public void write(byte[] arg0,
                  int arg1,
                  int arg2)
Overrides:
write in class java.io.PrintStream


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.