jwo.utils
Class OutputLogger

java.lang.Object
  extended byjwo.utils.OutputLogger

public class OutputLogger
extends Object

Allows standard output and standard error output to be redirected to an arbitrary log file. Useful for recording detailed error/usage ouput, or for providing an output console available to the client program.

Version:
2.2, 23rd February, 2004.
Author:
Jo Wood

Field Summary
static int STANDARD_ERR
          Indicates standard error stream.
static int STANDARD_OUT
          Indicates standard output stream.
 
Constructor Summary
OutputLogger()
          Redirects standard and error output to the defult logger output.
OutputLogger(Logger logger)
          Redirects standard and error output to the given logger.
 
Method Summary
 Logger getLogger()
          Reports the logger used to capture output.
static String getStackTraceAsString(Exception e)
          Reports a full stack trace as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD_OUT

public static final int STANDARD_OUT
Indicates standard output stream.

See Also:
Constant Field Values

STANDARD_ERR

public static final int STANDARD_ERR
Indicates standard error stream.

See Also:
Constant Field Values
Constructor Detail

OutputLogger

public OutputLogger()
Redirects standard and error output to the defult logger output. Uses a default 'jwo.utils' logger.


OutputLogger

public OutputLogger(Logger logger)
Redirects standard and error output to the given logger.

Parameters:
logger - Logger that will capture output.
Method Detail

getStackTraceAsString

public static String getStackTraceAsString(Exception e)
Reports a full stack trace as a string. Useful for sending exception stack traces to the logger.

Parameters:
e - Exception to store.
Returns:
String holding full stack trace of exception.

getLogger

public Logger getLogger()
Reports the logger used to capture output.

Returns:
Logger used to capture output.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005