다음 예제 코드는 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()");
}
}
다음 예제 코드는 .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()");
}
}
이 예제에서 FtDebug() 메소드가 myproxies 문자열을 전달합니다. C:\Program Files\IBM\SDP70\FunctionalTester\bin\에 있는 ivory.properties 파일에서 이 문자열을 사용하여 실행 시 생성되는 로그 정보 레벨을 제어할 수 있습니다. 다음 예제 코드는 ivory.properties 파일에서 myproxies 문자열을 이용하는 방법을 보여줍니다.
### ### 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;이 예제에서 myproxies 문자열의 값은 3으로 설정됩니다. 이런 방법으로 ivDebug.txt 파일에 저장되는 디버깅 정보의 레벨을 제어할 수 있습니다.