| java.lang.Object migration.modules.rules.Debug
Debug | public class Debug (Code) | | |
Field Summary | |
final public static int | ERROR flags the state where error debugging is enabled. | final public static int | MESSAGE This state enables debugging of messages, warnings and errors. | final public static int | OFF flags the disabled debug state. | final public static int | ON flags the enabled debug state for warnings, errors and messages.
Printing to a file is disabled. | final public static int | WARNING flags the state where warning debugging is enabled, but message
debugging is disabled. |
Method Summary | |
public void | destroy() Destroys the debug object, closes the debug file and releases any system
resources. | public void | error(String msg) Prints error messages only when debug level is greater than DEBUG.OFF.
Parameters: msg - message to be printed. | public void | error(String msg, Throwable t) Prints error messages only if debug state is greater than
Debug.OFF. | protected void | finalize() Flushes and then closes the debug file. | public static synchronized Debug | getInstance(String debugName) Gets an existing instance of Debug for the specified debug file or a new
one if no such instance already exists. | public int | getState() | public void | message(String msg) Prints messages only when the debug state is either
DEBUG.MESSAGE or Debug.ON.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. | public void | message(String msg, Throwable t) Prints debug and exception messages only when the debug
state is either DEBUG.MESSAGE or Debug.ON. | public boolean | messageEnabled() Checks if message debugging is enabled.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. | public void | setDebug(int debugType) Sets the debug capabilities based on the values of the
debugType argument. | public void | setDebug(String debugType) Sets the debug capabilities based on the values of the
debugType argument. | public void | warning(String msg) Prints warning messages only when debug level is greater than
DEBUG.ERROR.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. | public void | warning(String msg, Throwable t) Prints warning messages only when debug level is greater than
DEBUG.ERROR.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. | public boolean | warningEnabled() Checks if warning debugging is enabled.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. |
ERROR | final public static int ERROR(Code) | | flags the state where error debugging is enabled. When debugging is set
to less than ERROR , error debugging is also disabled.
|
MESSAGE | final public static int MESSAGE(Code) | | This state enables debugging of messages, warnings and errors.
|
OFF | final public static int OFF(Code) | | flags the disabled debug state.
|
ON | final public static int ON(Code) | | flags the enabled debug state for warnings, errors and messages.
Printing to a file is disabled. All printing is done on System.out.
|
WARNING | final public static int WARNING(Code) | | flags the state where warning debugging is enabled, but message
debugging is disabled. When debugging is set to less than
WARNING , warning debugging is also disabled.
|
destroy | public void destroy()(Code) | | Destroys the debug object, closes the debug file and releases any system
resources. 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.
If this object is accessed after destroy() has been
invoked, the results are undefined.
|
error | public void error(String msg)(Code) | | Prints error messages only when debug level is greater than DEBUG.OFF.
Parameters: msg - message to be printed. A newline will be appended to themessage before printing either to System.out or to the debug file. If msg is null, it isignored. See Also: Debug.error(String msgThrowable t) |
error | public void error(String msg, Throwable t)(Code) | | Prints error messages only if debug state is greater than
Debug.OFF. If the debug file is not accessible and debugging is enabled,
the message along with a timestamp 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.
Parameters: msg - message to be printed. A newline will be appended to themessage before printing either to System.out or to the debug file. If msg is null, it isignored. Parameters: t - Throwable, on which printStackTrace() will beinvoked to print the stack trace. If t isnull, it is ignored. |
finalize | protected void finalize()(Code) | | Flushes and then closes the debug file.
|
getInstance | public static synchronized Debug getInstance(String debugName)(Code) | | Gets an existing instance of Debug for the specified debug file or a new
one if no such instance already exists. If a Debug object has to be
created, its level is set to the level defined in the
AMConfig.properties file. The level can be changed later
by using
Debug.setDebug(int) or
Debug.setDebug(String) Parameters: debugName - the name of the debug file to create or use a debug instance corresponding to the specified debug file |
getState | public int getState()(Code) | | Returns one of the five possible values:
Debug.OFF
Debug.ERROR
Debug.WARNING
Debug.MESSAGE
Debug.ON
the debug level |
message | public void message(String msg)(Code) | | Prints messages only when the debug state is either
DEBUG.MESSAGE or Debug.ON.
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.
See Also: Debug.message(String msgThrowable t) |
message | public void message(String msg, Throwable t)(Code) | | 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 timestamp
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.
Parameters: msg - message to be printed. A newline will be appended to themessage before printing either to System.out or to the debug file. If msg is null, it isignored. Parameters: t - Throwable, on which printStackTrace will beinvoked to print the stack trace. If t isnull, it is ignored. See Also: Debug.error(String msgThrowable t) |
messageEnabled | public boolean messageEnabled()(Code) | | Checks if message debugging is enabled.
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
messageEnabled() be called to check the debug state
before invoking any message() methods to avoid
unnecessary argument evaluation and maximize application performance.
true if message debugging is enabledfalse if message debugging is disabled |
setDebug | public void setDebug(int debugType)(Code) | | Sets the debug capabilities based on the values of the
debugType argument.
Parameters: debugType - is any one of five possible values:Debug.OFF
Debug.ERROR
Debug.WARNING
Debug.MESSAGE
Debug.ON
|
setDebug | public void setDebug(String debugType)(Code) | | Sets the debug capabilities based on the values of the
debugType argument.
Parameters: debugType - is any one of the following possible values:off - debugging is disabled on - all debugging is enabled and written toSystem.out message - message debugging is enabled and written to the debugfile warning - warning debugging is enabled and written to the debug fileerror - error debugging is enabled and written to the debug file |
warning | public void warning(String msg)(Code) | | Prints warning messages only when debug level is greater than
DEBUG.ERROR.
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.
Parameters: msg - message to be printed. A newline will be appended to themessage before printing either to System.out or to the debug file. If msg is null, it isignored. See Also: Debug.warning(String msgThrowable t) |
warning | public void warning(String msg, Throwable t)(Code) | | Prints warning messages only when debug level is greater than
DEBUG.ERROR.
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 debuging is enabled, the
message along with a timestamp 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.
Parameters: msg - message to be printed. A newline will be appended to themessage before printing either to System.out or to the debug file. If msg is null, it isignored. Parameters: t - Throwable, on which printStackTrace() will beinvoked to print the stack trace. If t isnull, it is ignored. |
warningEnabled | public boolean warningEnabled()(Code) | | Checks if warning debugging is enabled.
NOTE: Debugging is an IO intensive operation and may hurt
application performance when abused. Particularly, note that Java
evaluates arguments to warning() even when
warning debugging is turned off. It is recommended that
warningEnabled() be called to check the debug state
before invoking any warning() methods to avoid
unnecessary argument evaluation and maximize application performance.
true if warning debugging is enabledfalse if warning debugging is disabled |
|
|