IM-BIS for Accel Platform OpenRules for IM-BIS 連携ガイド 第9版 2019-04-01

3. OpenRules でデバッグをするための設定

OpenRules をデータソース定義に登録して利用する場合に、デバッグを行うための方法です。

3.1. OpenRules のログをログファイルに出力するための設定

OpenRules のログを出力するためのロガーを設定します。
デバッグ時には、「trace」レベルのログまで出力すると、値の受け渡しの処理などを確認できます。
運用時にはログファイルサイズが大きくなりすぎるため、「WARN」以上とすることを推奨します。

3.1.1. 設定ファイルの設定

設定ファイルに以下のように記述すると、 OpenRules の実行時のログをすべて出力することができます。
ファイルの詳細は「 設定ファイルリファレンス 」で確認してください。
<logger name="org.openl.util.Log">
  <level value="all" />
</logger>
上記の設定後には、サーバを再起動すると変更内容が反映されます。

3.1.2. Excelの定義ファイルの設定

Excelの定義ファイル上で、 Decision に以下のように記述すると、各処理のタイミングで渡されたオブジェクトの値をログファイルに出力します。
../../_images/decision_setting_log.png

3.1.3. 出力されるログイメージ

上記のように設定を行った後、ルールを実行すると、以下のような形で出力されますので、ログを確認し、エラーの解決等にご利用ください。
[2015-03-24 11:48:01.580]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute setDecisionVar
[2015-03-24 11:48:01.580]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute initializeDecision
[2015-03-24 11:48:01.581]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] *** Decision sampleDailyAllowance ***
[2015-03-24 11:48:01.581]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision has been initialized
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute decisionObjects
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke DecisionObjectTemplate
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] []
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke decisionObjects
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] [TTT]
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute initializeDecisionRun
[2015-03-24 11:48:01.581]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision Run has been initialized
[2015-03-24 11:48:01.581]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute sampleDailyAllowance
[2015-03-24 11:48:01.582]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke DecisionTemplate
[2015-03-24 11:48:01.582]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke sampleDailyAllowance
[2015-03-24 11:48:01.582]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision sampleDailyAllowance: 入力内容の表示
[2015-03-24 11:48:01.582]  [resin-port-8080-87] TRACE org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] RequestObject(id=0) {
  areaClassCode=overseas
  tripClassCode=single-day
}
[2015-03-24 11:48:01.582]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision sampleDailyAllowance: 場所の変換
[2015-03-24 11:48:01.582]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute convertArea
[2015-03-24 11:48:01.582]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke convertArea
[2015-03-24 11:48:01.582]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] [fT]
[2015-03-24 11:48:01.582]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Conclusion: 場所 = 国外
[2015-03-24 11:48:01.582]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision sampleDailyAllowance: 出張区分の変換
[2015-03-24 11:48:01.583]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute convertTripClass
[2015-03-24 11:48:01.583]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke convertTripClass
[2015-03-24 11:48:01.583]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] [fT]
[2015-03-24 11:48:01.583]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Conclusion: 出張区分 = 日帰り
[2015-03-24 11:48:01.583]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision sampleDailyAllowance: 日当の計算
[2015-03-24 11:48:01.583]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute setDailyAllowance
[2015-03-24 11:48:01.584]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Invoke setDailyAllowance
[2015-03-24 11:48:01.584]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] [ffT]
[2015-03-24 11:48:01.584]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Conclusion: 日当 = 2000
[2015-03-24 11:48:01.584]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision sampleDailyAllowance: 結果の取得
[2015-03-24 11:48:01.584]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision sampleDailyAllowance: 出力内容の表示
[2015-03-24 11:48:01.584]  [resin-port-8080-87] TRACE org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] ResponseObject(id=0) {
  dailyAllowance=2000
  dummy=ダミー内容
}
[2015-03-24 11:48:01.584]  [resin-port-8080-87] DEBUG org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Execute finalizeDecision
[2015-03-24 11:48:01.584]  [resin-port-8080-87] INFO  org.openl.util.Log   tenant1     5ieoz3s029tyzpd   -  [] Decision has been finalized

3.2. OpenRules の入出力内容をコンソールに出力するための設定

OpenRules の実行時に入力・出力のオブジェクトが保持している値をコンソールに出力するための設定方法です。
ログファイルの出力時より出力される内容は少なくなりますが、実行前後の入出力の内容がコンソールに出力されますので、開発環境などコンソールで確認が行いやすい場合には簡単に利用できます。

3.2.1. Excelの定義ファイルの設定

Excelの定義ファイル上で、 Decision に以下のように記述すると、各処理のタイミングで渡されたオブジェクトの値をコンソールに出力します。
../../_images/decision_setting_console.png

3.2.2. 出力されるコンソールのイメージ

上記のように設定を行った後、ルールを実行すると、以下のような形で出力されますので、内容を確認し、エラーの解決等にご利用ください。
[INFO] o.o.u.Log - [] *** Decision sampleDailyAllowance ***
[INFO] o.o.u.Log - [] Decision has been initialized
[INFO] o.o.u.Log - [] Decision Run has been initialized
[INFO] o.o.u.Log - [] Decision sampleDailyAllowance: 入力内容の表示
RequestObject(id=0) {
  areaClassCode=overseas
  tripClassCode=single-day
}
[INFO] o.o.u.Log - [] Decision sampleDailyAllowance: 場所の変換
[INFO] o.o.u.Log - [] Conclusion: 場所 = 国外
[INFO] o.o.u.Log - [] Decision sampleDailyAllowance: 出張区分の変換
[INFO] o.o.u.Log - [] Conclusion: 出張区分 = 日帰り
[INFO] o.o.u.Log - [] Decision sampleDailyAllowance: 日当の計算
[INFO] o.o.u.Log - [] Conclusion: 日当 = 2000
[INFO] o.o.u.Log - [] Decision sampleDailyAllowance: 結果の取得
[INFO] o.o.u.Log - [] Decision sampleDailyAllowance: 出力内容の表示
ResponseObject(id=0) {
  dailyAllowance=2000
  dummy=ダミー内容
}
[INFO] o.o.u.Log - [] Decision has been finalized