詳細な SQL ログの有効化

お困りですか?

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

コミュニティに質問

Confluence uses the open source persistence framework Hibernate. This page tells you how to configure Confluence's logging to report individual SQL requests that are sent to the database by Hibernate. It is useful for troubleshooting the following events:

  • XML site backups that fail to import.
  • 不正なデータベース操作が原因の例外

Enable SQL logging via the Administration Console

Since the 2.7 release, you can also enable SQL logging at runtime via the Administration Console — read the instructions. This runtime option does not allow you to enable logging of SQL parameter values. To log the parameters as well, continue with the steps below.

To enable detailed SQL logging in Confluence, you need to modify log4j.properties, located in confluence/WEB-INF/classes.

(info) After you have enabled hibernate logging, please replicate the action that is causing the error in the first place. This is the best way to ensure that the Confluence log file contains relevant SQL logging.

If you require support assistance with a database related problem, it is advisable to enable detailed SQL logging before sending us the log files. This will assist us in determining what SQL queries were running during the reported problem.

(info) If the entries mentioned below are not defined in the log4j.properties file, you can manually add the entries to the file in the 'Hibernate Logging' section.

To Log SQL Queries with Parameters

  1. Confluence を停止します。
  2. Change the following lines in log4j.properties from ERROR to DEBUG:

    ## log hibernate prepared statements/SQL queries (equivalent to setting 'hibernate.show_sql' to 'true')
    ## DEBUG, TRACE or ALL is required to see query strings
    log4j.logger.net.sf.hibernate.SQL=DEBUG
  3. Uncomment the following lines in log4j.properties:

    ## log hibernate prepared statement parameter values. Note: due to caching in net.sf.hibernate.type.NullableType, requires restart to take effect
    ## TRACE or ALL is required to see parameter values
    ## Note that log4j.appender.confluencelog.Threshold (or other appenders) also must be TRACE or ALL to see any trace messages in the logs
    log4j.logger.net.sf.hibernate.type=TRACE
  4. Change the following lines in log4j.properties from DEBUG to TRACE:

    log4j.appender.confluencelog.Threshold=TRACE
  5. Confluence を起動します。

関連トピック

Troubleshooting SQL exceptions
Working with Confluence Logs

最終更新日: 2015 年 12 月 2 日

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

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