ページの先頭行へ戻る
Interstage Business Application Server オープンJavaフレームワークユーザーズガイド
FUJITSU Software

10.2.5 ExtTimeComposerクラスを用いてログを出力する

ExtTimeComposerクラスを用いてログを出力する場合

(ExtTimeComposerを用いてログ出力を行う場合)

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.fujitsu.interstage.apfw.logging.ApfwLogger;
import com.fujitsu.uji.log.ext.ExtTimeComposer;
   ・・・
public class MyApp {
    Log _log = null;
    ApfwLogger _al = null;
    ExtTimeComposer _etc = null;
    ・・・
    public void method1() {
        if( _log == null ) {
            // ログ定義ファイルに記述したLogComposer"Log1"のログ出力クラスを取得します
            _log = LogFactory.getLog("Log1");
            _al = (ApfwLogger)_log;
            // ExtTimeComposerを取得します
            _etc = (ExtTimeComposer)_al.getLogComposer();
        }
        // ExtTimeComposerクラスに渡すデータを生成
        long _currentTime;
        ・・・
        if( _etc != null ) {
            // ログを出力します
            _etc.printTime(_currentTime,5,"code","name","subname","messageID");
        } else {
            // ログ出力クラスのオブジェクトがnullのため、ログの出力ができません
            ・・・
        }
    }
}