Implementing logs for proxy code debug

HCL OneTest UI 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, a new instance of the FtDebug() class, called myproxies, is created. You can control the level of trace information emitted during execution, using the Trace Components settings on the Logging and Tracing page.