To customize the debugging process, you can add calls to other Debug methods.
In these methods, the first (object) parameter is usually this to specify the calling object. If any of these methods are static, use null for the object parameter.
println
Use this method to define the message to print in the output log if debugging is enabled and the object is included in the list of classes to debug. The debug output goes to the file you specified with sybdebug.debug.
The syntax is:
sybdebug.println(object,message string);
For example:
sybdebug.println(this,"Query: "+ query);
produces a message similar to this in the output log:
myApp(thread[x,y,z]): Query: select * from authors
assert
Use this method to assert a condition and throw a runtime exception when the condition is not met. You can also define the message to print in the output log if the condition is not met. The syntax is:
sybdebug.assert(object,boolean condition,message string);
For example:
sybdebug.assert(this,amount<=buf.length,amount+" too big!");
produces a message similar to this in the output log if “amount” exceeds the value of buf.length:
java.lang.RuntimeException:myApp(thread[x,y,z]): Assertion failed: 513 too big! at jdbc.sybase.utils.sybdebug.assert( sybdebug.java:338) at myApp.myCall(myApp.java:xxx) at .... more stack:
startTimer stopTimer
Use these methods to start and stop a timer that measures the milliseconds that elapse during an event. The method keeps one timer per object, and one for all static methods. The syntax to start the timer is:
sybdebug.startTimer(object);
The syntax to stop the timer is:
sybdebug.stopTimer(object,message string);
For example:
sybdebug.startTimer(this); stmt.executeQuery(query); sybdebug.stopTimer(this,"executeQuery");
produces a message similar to this in the output log:
myApp(thread[x,y,z]):executeQuery elapsed time = 25ms