Jira サーバーで SQL クエリのロギングを有効化する

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

このナレッジベース記事では、Jira 内の詳細な SQL ロギングを有効化する方法を説明します。これは次のような場合に使用できます。

  • データベースの SQL の問題のトラブルシューティング
  • 特定のユーザー アクションで送信された SQL を判断するための、GUI アクションのリバースエンジニアリング

This is broken down into two sections, OfBiz and Active Objects. They are both persistence ORM frameworks which means they're libraries that can be used to manage the SQL sent to different database systems.

  • OfBiz: Used by standard JIRA functionality.
  • Active Objects: Used by plugins, both third-party and bundled. Active Objects tables can be identified as they're named AO_<code>_TABLENAME.


It's important to note enabling SQL logging on production instances may cause a performance degradation on Jira, impacting the ability of end-users to conduct their work.

When possible, work on a lower environment or outside business hours to minimize impact on end-users. If that's not possible, you may consider enabling DEBUG level logs instead of TRACE to reduce the amount of logs generated and also slow down how often these logs will rotate.


ソリューション

SQL ロギングを一時的に有効化する方法

  1. Jira に管理者としてログインします。
  2. [管理] > [システム] > [ロギングとプロファイリング] に移動します。

  3. OfBiz の場合: 

    1. 次のように SQL ロギングを有効化します。

    2. 結果のログは <JIRA HOME>/log/atlassian-jira-sql.log に記録されます。

  4. Active Objects の場合:

    1. Search for net.java.ao.sql and set it to TRACE:

    2. In the logging page, click at the Configure option as shown below. Add the package com.querydsl.sql and set it to TRACE:
    3. 結果のログは <JIRA HOME>/log/atlassian-jira.log に記録されます。

(info) これらの設定はメモリに保管されるため、再起動すると失われます。


SQL ロギングを永続的に有効化する方法

  1. Jira で設定を保持したい場合、log4j.properties ファイルで設定を変更します。例:
  2. OfBiz については、この OFFON に設定します。

    log4j.logger.com.atlassian.jira.ofbiz.LoggingSQLInterceptor = OFF, sqllog
  3. Active Objects については、WARNTRACE に設定します。

    log4j.logger.net.java.ao.sql  = WARN, console, filelog
    
    
    # Append the following at the end of the file
    log4j.logger.com.querydsl.sql = TRACE, console, sqllog
    log4j.additivity.com.querydsl.sql = false

ファイル サイズの構成

デフォルトの構成では、ローリングされるログ ファイルが 5 個 (サイズは 20 MB、合計で最大 100 MB) 許可されます。この設定を調整するには log4j.properties ファイルを更新します。  




最終更新日 2023 年 4 月 3 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.