public class Debugger extends Object
Modifier and Type | Method and Description |
---|---|
static void |
error(CommandManager mgr,
String msg)
Prints error messages only when debug level is greater than DEBUG.OFF.
|
static void |
error(CommandManager mgr,
String msg,
Throwable t)
Prints error messages only if debug state is greater than
Debug.OFF.
|
static String |
getStackTrace(Throwable e)
Returns stack trace of an exception.
|
static void |
message(CommandManager mgr,
String msg)
Prints messages only when the debug state is either
Debug.MESSAGE or Debug.ON.
|
static void |
message(CommandManager mgr,
String msg,
Throwable t)
Prints debug and exception messages only when the debug
state is either Debug.MESSAGE or Debug.ON.
|
static void |
warning(CommandManager mgr,
String msg)
Prints warning messages only when debug level is greater than
Debug.ERROR.
|
static void |
warning(CommandManager mgr,
String msg,
Throwable t)
Prints warning messages only when debug level is greater than
Debug.ERROR.
|
public static void message(CommandManager mgr, String msg)
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. Particularly, note that Java
evaluates arguments to message()
even when
debugging is turned off. So when the argument to this method involves
the String concatenation operator '+' or any other method invocation,
messageEnabled
MUST be used. It is recommended that
the debug state be checked by invoking messageEnabled()
before invoking any message()
methods to avoid
unnecessary argument evaluation and maximize application performance.
mgr
- Command Manager Object.msg
- debug message.Debug.message(String, Throwable)
public static void message(CommandManager mgr, String msg, Throwable t)
Prints debug and exception messages only when the debug
state is either Debug.MESSAGE or Debug.ON. If the debug file is not
accessible and debugging is enabled, the message along with a time stamp
and thread info will be printed on System.out
.
This method creates the debug file if does not exist; otherwise it starts appending to the existing debug file. When invoked for the first time on this object, the method writes a line delimiter of '*'s.
Note that the debug file will remain open until destroy()
is invoked. To conserve file resources, you should invoke
destroy()
explicitly rather than wait for the garbage
collector to clean up.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. Particularly, note that
Java evaluates arguments to message()
even when
debugging is turned off. It is recommended that the debug state be
checked by invoking messageEnabled()
before invoking any
message()
methods to avoid unnecessary argument evaluation
and to maximize application performance.
mgr
- Command Manager Object.msg
- message to be printed. A newline will be appended to the
message before printing either to System.out
or to the debug file. If msg
is null, it is
ignored.t
- Throwable
, on which printStackTrace
will be invoked to print the stack trace. If t
is
null, it is ignored.Debug.error(String, Throwable)
public static void warning(CommandManager mgr, String msg)
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. Particularly, note that
Java evaluates arguments to warning()
even when
debugging is turned off. So when the argument to this method involves
the String concatenation operator '+' or any other method invocation,
warningEnabled
MUST be used. It is recommended that
the debug state be checked by invoking warningEnabled()
before invoking any warning()
methods to avoid
unnecessary argument evaluation and to maximize application
performance.
mgr
- Command Manager Object.msg
- message to be printed. A newline will be appended to the
message before printing either to System.out
or to the debug file. If msg
is null, it is
ignored.Debug.warning(String, Throwable)
public static void warning(CommandManager mgr, String msg, Throwable t)
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. Particularly, note that
Java evaluates arguments to warning()
even when
debugging is turned off. It is recommended that the debug state be
checked by invoking warningEnabled()
before invoking any
warning()
methods to avoid unnecessary argument evaluation
and to maximize application performance.
If the debug file is not accessible and debugging is enabled, the
message along with a time stamp and thread info will be printed on
System.out
.
This method creates the debug file if does not exist; otherwise it starts appending to the existing debug file. When invoked for the first time on this object, the method writes a line delimiter of '*'s.
Note that the debug file will remain open until destroy()
is invoked. To conserve file resources, you should invoke
destroy()
explicitly rather than wait for the garbage
collector to clean up.
mgr
- Command Manager Object.msg
- message to be printed. A newline will be appended to the
message before printing either to System.out
or to the debug file. If msg
is null, it is
ignored.t
- Throwable
, on which printStackTrace()
will be invoked to print the stack trace. If t
is
null, it is ignored.public static void error(CommandManager mgr, String msg)
mgr
- Command Manager Object.msg
- message to be printed. A newline will be appended to the
message before printing either to System.out
or to the debug file. If msg
is null, it is
ignored.Debug.error(String, Throwable)
public static void error(CommandManager mgr, String msg, Throwable t)
System.out
.
This method creates the debug file if does not exist; otherwise it starts appending to the existing debug file. When invoked for the first time on this object, the method writes a line delimiter of '*'s.
Note that the debug file will remain open until destroy()
is invoked. To conserve file resources, you should invoke
destroy()
explicitly rather than wait for the garbage
collector to clean up.
mgr
- Command Manager Object.msg
- message to be printed. A newline will be appended to the
message before printing either to System.out
or to the debug file. If msg
is null, it is
ignored.t
- Throwable
, on which printStackTrace()
will be invoked to print the stack trace. If t
is
null, it is ignored.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.