|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.Debug
public final class Debug
provides globally accessible methods and variables for convenient debugging
Monitor| Nested Class Summary | |
|---|---|
static class |
Debug.FileExceptionHandler
can be used to conveniently write all exceptions to a file. |
| Field Summary | |
|---|---|
static Thread.UncaughtExceptionHandler |
dialogExceptionHandler
can be used to display a dialog for uncaught exceptions. |
static boolean |
enabled
false by default |
static MyFile |
file
a MyFile object that is initially null |
static Logger |
logger
the logger is initialized as a plain empty logger ignoring occurring exceptions in writers |
static Monitor |
monitor
monitor is initialized with new Monitor() |
static Stopwatch |
stopwatch
initialized as non-running |
| Method Summary | ||
|---|---|---|
static void |
addSystemErrFile(File file,
boolean append)
|
|
static void |
addSystemOutFile(File file,
boolean append)
|
|
static TimerTask |
createMemoryLogTimer()
|
|
static void |
dumpAllStacks()
|
|
static int |
dumpHeap(File file)
|
|
static void |
dumpSettings()
prints all settings to the console. |
|
static void |
dumpStack()
|
|
static void |
dumpStack(Thread t)
|
|
static
|
find(Throwable t,
Class<T> exceptionType)
looks if any exception in the getCause()-path is an instance of the given type and if so returns it - otherwise null is returned |
|
static String |
getAllStackTracesAsString()
|
|
static String |
getFieldDetailsAsString(Object obj)
|
|
static int |
getProcessID()
|
|
static String |
getSettingsAsString()
provides a String containing application settings, system settings, environment settings, L&Fs and memory info. |
|
static String |
getStackTraceAsString()
excludes the call to this method and beyond in the stack trace |
|
static String |
getStackTraceAsString(StackTraceElement[] stack,
boolean reversed)
|
|
static String |
getStackTraceAsString(Thread t)
|
|
static boolean |
isDevEnv()
returns true only if the system can determine that the JVM runs on a special development environment where possibly some testing options ought to be enabled |
|
static boolean |
isTesting()
|
|
static String |
memoryString()
|
|
static boolean |
printToFile(Throwable t,
File file,
boolean append)
returns true only if operation was successful |
|
static File |
printToTempFile(Throwable t)
returns the name of the temp file the Throwable was written to or null if the write attempt was unsuccessful. |
|
static void |
say(Object txt)
just for test debugging; prints the text along w/ the word debug on the console (to distinguish from standard System.out.println() in the source code) |
|
static void |
setSystemErr(File file,
boolean append)
|
|
static void |
setSystemOut(File file,
boolean append)
|
|
static void |
setTesting(boolean flag)
|
|
static void |
show(Component parent,
Object message)
displays a debug message in a modal dialog |
|
static void |
show(Object message)
displays a debug message in a modal dialog |
|
static JMainFrame |
showMemoryGauge()
pops up a JMemoryGauge in a simple JMainFrame |
|
static String |
stackTraceAsString(Throwable t)
|
|
static String |
stackTraceAsString(Throwable tw,
Thread td)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Thread.UncaughtExceptionHandler dialogExceptionHandler
Thread.setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler),
Thread.setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler)public static final Monitor monitor
public static volatile boolean enabled
public static final Logger logger
public static final Stopwatch stopwatch
public static volatile MyFile file
| Method Detail |
|---|
public static boolean isTesting()
public static void setTesting(boolean flag)
public static boolean isDevEnv()
public static TimerTask createMemoryLogTimer()
public static String getFieldDetailsAsString(Object obj)
public static String memoryString()
public static JMainFrame showMemoryGauge()
JMemoryGauge
public static <T> T find(Throwable t,
Class<T> exceptionType)
public static void show(Object message)
public static void show(Component parent,
Object message)
public static String stackTraceAsString(Throwable t)
public static String stackTraceAsString(Throwable tw,
Thread td)
public static File printToTempFile(Throwable t)
public static boolean printToFile(Throwable t,
File file,
boolean append)
public static String getSettingsAsString()
Settings,
System.getProperties(),
System.getenv()public static void dumpSettings()
public static String getStackTraceAsString()
public static String getStackTraceAsString(StackTraceElement[] stack,
boolean reversed)
public static String getStackTraceAsString(Thread t)
public static String getAllStackTracesAsString()
public static void dumpStack()
public static void dumpAllStacks()
public static void dumpStack(Thread t)
public static int getProcessID()
@Todo
public static int dumpHeap(File file)
throws IOException,
InterruptedException
IOException
InterruptedException
public static void addSystemErrFile(File file,
boolean append)
throws FileNotFoundException
FileNotFoundException
public static void addSystemOutFile(File file,
boolean append)
throws FileNotFoundException
FileNotFoundException
public static void setSystemErr(File file,
boolean append)
throws FileNotFoundException
FileNotFoundException
public static void setSystemOut(File file,
boolean append)
throws FileNotFoundException
FileNotFoundExceptionpublic static void say(Object txt)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||