以下のサンプル・コードは、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()");
}
}
この例では、myproxies という名前の、FtDebug() クラスの新しいインスタンスが作成されます。 「ロギングおよびトレース」ページのトレース・コンポーネント設定を使用して、実行中に出されるトレース情報のレベルを制御することができます。 詳しくは、「ロギングおよびトレース」ページを参照してください。