ccs.utils
Class LogFile

java.lang.Object
  extended by java.io.OutputStream
      extended by ccs.utils.LogFile
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

Deprecated. Java now provides a standard logging API; use that instead.

public class LogFile
extends java.io.OutputStream

Reroute System.out and System.err to a log file. Useful for systems which aren't running under a console (e.g. from a GUI-based bootstrap) which may generate error-messages which you need to trap for debugging / fault finding etc.

Update: This code has rotted - I don't think it ever worked properly. Probably best avoided pending review.


Method Summary
static void reroute(java.io.File f, boolean isLog)
          Deprecated. Reroute system output streams to a file.
static void setLog(boolean value)
          Deprecated. Set whether to actually send incoming messages to the log file, or to just swallow them.
 void write(byte[] b)
          Deprecated. Writes b.length bytes from the specified byte array to this output stream.
 void write(byte[] b, int off, int len)
          Deprecated. Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Deprecated. Writes the specified byte to the logfile or swallows it.
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reroute

public static void reroute(java.io.File f,
                           boolean isLog)
Deprecated. 
Reroute system output streams to a file.

Parameters:
f - the File to reroute to. If null, the output is swallowed.
isLog - whether to record output: if false, output is swallowed.

setLog

public static void setLog(boolean value)
Deprecated. 
Set whether to actually send incoming messages to the log file, or to just swallow them.

Parameters:
value - true to log, false to swallow.

write

public void write(int b)
           throws java.io.IOException
Deprecated. 
Writes the specified byte to the logfile or swallows it.

Specified by:
write in class java.io.OutputStream
Parameters:
b - the byte.
Throws:
java.io.IOException - if an I/O error occurs.

write

public void write(byte[] b)
           throws java.io.IOException
Deprecated. 
Writes b.length bytes from the specified byte array to this output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
b - the data.
Throws:
java.io.IOException - if an I/O error occurs.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Deprecated. 
Writes len bytes from the specified byte array starting at offset off to this output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
java.io.IOException - if an I/O error occurs.