org.jscience.util
Class Debug

java.lang.Object
  extended by org.jscience.util.Debug

public final class Debug
extends java.lang.Object

provides globally accessible methods and variables for convenient debugging

See Also:
Monitor

Nested Class Summary
static class Debug.FileExceptionHandler
          can be used to conveniently write all exceptions to a file.
 
Field Summary
static java.lang.Thread.UncaughtExceptionHandler dialogExceptionHandler
          can be used to display a dialog for uncaught exceptions.
static boolean enabled
          false by default
static ExtendedFile file
          a ExtendedFile object that is initially null
static Logger logger
          the logger is initialized as a plain empty logger
static Monitor monitor
          monitor is initialized with new Monitor(10)
static Stopwatch stopwatch
          initialized as non-running
 
Method Summary
static void addSystemErrFile(java.io.File file, boolean append)
          DOCUMENT ME!
static void addSystemOutFile(java.io.File file, boolean append)
          DOCUMENT ME!
static void dumpSettings()
          prints all settings (including all system properties and environment variables) to the console.
static void dumpStack()
          DOCUMENT ME!
static java.lang.String getStackTraceAsString()
          excludes the call to this method and beyond in the stack trace
static boolean printToFile(java.lang.Throwable t, java.io.File file, boolean append)
          returns true only if operation was successfull
static java.io.File printToTempFile(java.lang.Throwable t)
          returns the name of the temp file the Throwable was written to or null if the write attempt was unsuccessful.
static void setSystemErr(java.io.File file, boolean append)
          DOCUMENT ME!
static void setSystemOut(java.io.File file, boolean append)
          DOCUMENT ME!
static void showMemoryGauge()
          pops up a JMemoryGauge in a simple JMainFrame
static java.lang.String stackTraceAsString(java.lang.Throwable t)
          DOCUMENT ME!
static java.lang.String stackTraceAsString(java.lang.Throwable tw, java.lang.Thread td)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dialogExceptionHandler

public static final java.lang.Thread.UncaughtExceptionHandler dialogExceptionHandler
can be used to display a dialog for uncaught exceptions.

See Also:
Thread.setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler), Thread.setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler)

monitor

public static final Monitor monitor
monitor is initialized with new Monitor(10)


enabled

public static volatile boolean enabled
false by default


logger

public static final Logger logger
the logger is initialized as a plain empty logger


stopwatch

public static final Stopwatch stopwatch
initialized as non-running


file

public static ExtendedFile file
a ExtendedFile object that is initially null

Method Detail

showMemoryGauge

public static void showMemoryGauge()
pops up a JMemoryGauge in a simple JMainFrame

See Also:
JMemoryGauge

stackTraceAsString

public static java.lang.String stackTraceAsString(java.lang.Throwable t)
DOCUMENT ME!

Parameters:
t - DOCUMENT ME!
Returns:
DOCUMENT ME!

stackTraceAsString

public static java.lang.String stackTraceAsString(java.lang.Throwable tw,
                                                  java.lang.Thread td)
DOCUMENT ME!

Parameters:
tw - DOCUMENT ME!
td - DOCUMENT ME!
Returns:
DOCUMENT ME!

printToTempFile

public static java.io.File printToTempFile(java.lang.Throwable t)
returns the name of the temp file the Throwable was written to or null if the write attempt was unsuccessful.

Parameters:
t - DOCUMENT ME!
Returns:
DOCUMENT ME!

printToFile

public static boolean printToFile(java.lang.Throwable t,
                                  java.io.File file,
                                  boolean append)
returns true only if operation was successfull

Parameters:
t - DOCUMENT ME!
file - DOCUMENT ME!
append - DOCUMENT ME!
Returns:
DOCUMENT ME!

dumpSettings

public static void dumpSettings()
prints all settings (including all system properties and environment variables) to the console. The output is sorted by property name. System variables may be overwritten by system properties may be overwritten by application settings in this map.


getStackTraceAsString

public static java.lang.String getStackTraceAsString()
excludes the call to this method and beyond in the stack trace

Returns:
DOCUMENT ME!

dumpStack

public static void dumpStack()
DOCUMENT ME!


addSystemErrFile

public static void addSystemErrFile(java.io.File file,
                                    boolean append)
                             throws java.io.FileNotFoundException
DOCUMENT ME!

Parameters:
file - DOCUMENT ME!
append - DOCUMENT ME!
Throws:
java.io.FileNotFoundException - DOCUMENT ME!

addSystemOutFile

public static void addSystemOutFile(java.io.File file,
                                    boolean append)
                             throws java.io.FileNotFoundException
DOCUMENT ME!

Parameters:
file - DOCUMENT ME!
append - DOCUMENT ME!
Throws:
java.io.FileNotFoundException - DOCUMENT ME!

setSystemErr

public static void setSystemErr(java.io.File file,
                                boolean append)
                         throws java.io.FileNotFoundException
DOCUMENT ME!

Parameters:
file - DOCUMENT ME!
append - DOCUMENT ME!
Throws:
java.io.FileNotFoundException - DOCUMENT ME!

setSystemOut

public static void setSystemOut(java.io.File file,
                                boolean append)
                         throws java.io.FileNotFoundException
DOCUMENT ME!

Parameters:
file - DOCUMENT ME!
append - DOCUMENT ME!
Throws:
java.io.FileNotFoundException - DOCUMENT ME!