wt.util
Class LogFile

java.lang.Object
  extended bywt.util.LogFile

public class LogFile
extends Object

A convenience class for redirecting system output and error streams to a log file. It uses the LogOutputStream class to add log information to these streams.

This should only be used in an application main method. The System.out and System.err streams are static finals. Optimizing JIT compilers are allowed to perform optimzations on such variables that will produce possibly fatal runtime errors if they are changed later.

See Also:
LogOutputStream

Field Summary
private static String versionID
           
 
Constructor Summary
LogFile()
           
 
Method Summary
static void init(String name, boolean append, boolean tee)
          Creates a log file with the specified system dependent file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values
Constructor Detail

LogFile

public LogFile()
Method Detail

init

public static void init(String name,
                        boolean append,
                        boolean tee)
                 throws IOException
Creates a log file with the specified system dependent file name. The standard system output and error streams are redirected to this log file. Parent directories are automatically created if they do not exist.

This should only be used in an application main method. The System.out and System.err streams are static finals. Optimizing JIT compilers are allowed to perform optimzations on such variables that will produce possibly fatal runtime errors if they are changed later.

Parameters:
name - the system dependent file name
append - open file in append mode?
tee - tee output to both log file and current standard streams
Throws:
IOException - If the file cannot be opened.