Implementing logs for proxy code debug

Functional Tester provides a log infrastructure that you can use while debugging the developed proxy code. The FTDebug class is available in both Java and .Net proxy development frameworks. You can instantiate an object of the FTDebug class for each proxy class and log any information, warning, or error message categorically.


Before you begin

This example code shows how to implement logging for the proxy code in Java:

import com.rational.test.ft.util.FtDebug;
.
public class MyProxy extends BaseProxy
{
  protected static FtDebug debug = new FtDebug("myproxies");
  .
  void anyMethod()
  {
    debug.trace("Beginging of anyMethod()");
    .
    debug.verbose("I'm doing this!");
    .
    debug.warning("Not critical, good to have it fixed");
    .
    debug.error("I shouldn't have been here!!") ;
    .
    debug.trace("End of anyMethod()");
  }
}

This example code shows how to implement logging for the proxy code in .Net:

.
using Rational.Test.Ft.Util;
.
public class MyProxy : BaseProxy
{
  protected static FtDebug debug = new FtDebug("myproxies");
  .
  void anyMethod()
  {
    debug.Trace("Beginging of anyMethod()");
    .
    debug.Verbose("I'm doing this!");
    .
    debug.Warning("Not critical, good to have it fixed");
    .
    debug.Error("I shouldn't have been here!!") ;
    .
    debug.Trace("End of anyMethod()");
  }
}

In this example, the FtDebug() method passes the myproxies string. You can use this string in the ivory.properties file available in C:\Program Files\IBM\SDP70\FunctionalTester\bin\ to control the level of log information emitted while execution. This example code shows how you can use the myproxies string in the ivory.properties file:

###
### Debugging options
###
# The following propeties are used to control the debugging output generated by the FT
# product.  In production versions this output is minimal, limited primarily to error
# and warning level information.
rational.test.ft.debug.enabled=true
rational.test.ft.debug.clear_on_init=false
rational.test.ft.debug.filename=c:/ivDebug.txt
# filter levels: error,0;warning,1;debug,2;verbose,3
rational.test.ft.debug.filter=default,1;myproxies,3;
In this example, the value for the myproxies string is set to 3. This way, you can control the level of debugging information that is written into the ivDebug.txt file.