39
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめに

アプリケーション接続(JDBC)を利用している時に、トラブルシューティングのためにJDBCドライバ経由でどのようなSQLが実行されているのかを確認したい場合が出てくると思います。この記事では、アプリケーション接続(JDBC)が実行しているSQLを確認する手順を確認します。

なお、この記事は次の記事の内容を理解していることを前提としています。

SQLトレースの設定手順

ディレクトリ SAインストール先/apps/process-engine/<最新バージョン>/conf にあるファイル log4j2.xml をテキストエディタで開いて Loggers Node配下に <Logger name="ICrtConnectors" level="FINEST" additivity="true" /> を追記します。
以下、設定のサンプルです。

log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<Configuration status="INFO"
    monitorInterval="60"> <!-- dynamically pick up changes to configuration with in 60 seconds of change -->
        <Properties>
                <!-- Reference:  https://logging.apache.org/log4j/2.0/manual/layouts.html#PatternLayout -->
        <Property name="mdc.format">%d{dd-MMM-yyyy HH:mm:ss.SSS z} %level [%threadName] [%logger] [%X] - %message{nolookups} %n</Property>
                <Property name="cron.daily.rolling">0 0 0 * * ?</Property>
    </Properties>
        <CustomLevels>

                <CustomLevel name="OFF" intLevel="0" />
                <CustomLevel name="SEVERE" intLevel="200" />
                <CustomLevel name="WARNING" intLevel="300" />
                <CustomLevel name="INFO" intLevel="400" />
                <CustomLevel name="CONFIG" intLevel="500" />
                <CustomLevel name="FINE" intLevel="500" />
                <CustomLevel name="FINER" intLevel="600" />
                <CustomLevel name="FINEST" intLevel="600" />
        </CustomLevels>
    <Appenders>
...略...
    </Appenders>
    <Loggers>
      <Logger name="ICrtConnectors" level="FINEST" additivity="true" /> ★この行を追加

ファイルの保存後、Process Serverサービスの再起動をすることなく、設定は即時に反映されます。

JDBC接続のSQLトレース動作を確認する

まずはDBデータの登録(INSERT) にて作成した recipe-psa-jdbcInsert を実行します。

curlコマンドと実行結果
// curl コマンド
curl -k https://localhost:7443/process-engine/public/rt/recipe-psa-jdbcInsert

// 実行結果
{
  "error": {
    "code": 500,
    "detail": {
      "reason": "ORA-00001: unique constraint (SCHEMA.PK_RECIPETEST001PK) violated\n Query: Insert Into \"SCHEMA\".\"RECIPETEST001PK\" (\"COL1\",\"COL2\") Values (?,?) ",
      "code": "CreateDataException"
    },
    "message": "ORA-00001: unique constraint (SCHEMA.PK_RECIPETEST001PK) violated\n Query: Insert Into \"SCHEMA\".\"RECIPETEST001PK\" (\"COL1\",\"COL2\") Values (?,?) "
  }
}

次に、ディレクトリ SAインストール先/apps/process-engine/logs に出力されているカタリナログを確認してみましょう。

catalina.2025-12-04.log (実際には1行の出力です)
05-Dec-2025 15:07:43.694 IST INFO [QueueManagerWorkManager-WorkerThread-19] [ICrtConnectors] [{X_INFA_LOG_CTX=req_id=2a6036571ea94684bd8bf136070b1323
, mdc.process.id=21020, mdc.process.initiator=anonymous, mdc.process.name={project:/com.activevos.socrates.repository.services/bpel/hostRuntime}hostRuntime
, mdc.tenant.id=$public}] - JDBC  Write_10014 Level:
INFO Message:The Secure Agent runs the following SQL statement to insert data: [Insert Into "SCHEMA"."RECIPETEST001PK" ("COL1","COL2") Values (?,?)]

動作確認用に作成したテーブル RECIPETEST001PK に対してINSERT SQLを実行している様子を確認できました。Values(?,?) という指定ですので、値の部分は文字列指定ではなくバインド変数を使っている様子も確認できますね。

参照

39
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
39
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?