Confluence では、Apache の log4j ログ記録サービスを使用しています。これによって、開発者または管理者は、アプリケーション バイナリに触ることなく、設定ファイルを編集することで、ログ記録の動作やログ出力ファイルを制御することができます。log4j のログ レベルは6つあります。

On this page:

ログ設定ファイルの場所

Confluence's logging behaviour is defined in the following properties file:
<CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/log4j.properties

このファイルは、Apache の log4j ドキュメントに記載されているような、標準的な log4j 設定ファイルです。

Confluence ログ ファイルの検索

This section describes Confluence's default logging behaviour, assuming that you have not changed the destination of the logs.

For Confluence 2.6.x and earlier, the default behaviour is:

  • For Confluence Standalone, log entries are written to <confluence_install>/logs. The main log file is called atlassian-confluence.log.
  • For Confluence EAR/WAR, log entries are written to the application server logs, i.e. the default log files of the application container.

For Confluence 2.7.x and later, both Standalone and EAR/WAR editions follow the same default behaviour:

  • When you start Confluence, log entries will be sent to the application server logs until Confluence has completed its initial bootstrap. Any log entries written to the console will be repeated into the <confluence-home> log described below.
  • Once the initial startup sequence is complete, all logging will be to <confluence-home>/logs/atlassian-confluence.log. For example: c:/confluence/data/logs/atlassian-confluence.log.
    (info) Note that the default location is now the Confluence home directory instead of the application server's log file.

ログ ファイルの出力先の変更

用語: log4j では、出力先を「アペンダ」と呼びます。

To change the destination of the log files, you need to stop Confluence and then change the settings in the 'Logging Location and Appender' section of the log4j.properties file. The location of this file is described above.

In the standard properties file supplied with Confluence 2.7 and later, you will find entries for two appenders:

  • com.atlassian.confluence.logging.ConfluenceHomeLogAppender – This is a custom appender which controls the default logging destination described above. This appender allows the following settings:
    • MaxFileSize
    • MaxBackupIndex
  • org.apache.log4j.RollingFileAppender - 異なる場所にログを出力する場合、RollingFileAppender 行のコメント化を解除し、その下の行で出力ファイルを変更します。ConfluenceHomeLogAppender を参照する、手前の行をコメントアウトします。

Confluence には log4j の提供するアペンダの完全なスイートが同梱されています。アペンダの詳細については、log4j のドキュメントを参照してください。

ログ レベルの変更

Confluence のログ作成を自分自身の要件に設定することをお勧めします。以下の 2 通りの方法で、ログ設定を変更できます。

  • プロパティファイルを編集する – 変更は、次回 Confluence を開始したとき有効になり、それ以後のすべてのセッションに適用されます。
  • Set the logging levels at runtime – Your changes will be in effect only until you next restart Confluence.

Both methods are described below.

用語: log4j で、"logger" は、名前を持つエンティティです。logger 名では大文字と小文字が区別され、階層的な命名基準に従います。たとえば、com.foo という名前の logger は、com.foo.Bar という名前の logger の親です。

プロパティファイルを編集する

To configure the logging levels and other settings on a permanent basis, you need to stop Confluence and then change the settings in the log4j.properties file, described above.

プロパティファイルには、様々なロガーの多くのエントリが含まれています。これらは、特定のコンポーネントからログ作成したい場合、コメントを外すことができます。詳細は、Apache log4j ドキュメントをお読みください。

Below are some guidelines on specific configuration options you may find useful.

Changing the Logging Levels at Runtime

From Confluence 2.7, you can change some of Confluence's logging behaviour via the Administration Console while Confluence is running. Any changes made in this way will apply only to the currently-running Confluence lifetime. The changes are not written to the log4j.properties file and are therefore discarded when you next stop Confluence.

(info) Not all logging behaviour can be changed via the Administration Console. For logging configuration not mentioned below, you will need to stop Confluence and then edit the logging properties file instead.

ログとプロファイルの作成」画面には、現在のすべての定義済みロガーの一覧が表示されます。この画面では、以下の操作が可能です。

  • ページ プロファイルの作成のオンまたはオフ。
  • 詳細な SQL ログ作成のオンまたはオフ。
  • クラス/パッケージ名の新しいロガーの追加。
  • クラス/パッケージ名のロガーの削除。
  • 各クラスまたはパッケージ名のログ作成レベル (INFO、WARN、FATAL、ERROR またはDEBUG) の設定。
  • すべてのログ作成レベルを事前定義済みプロファイルにリセット。

To change the log levels at runtime,

  1. Go to the 'Administration Console' and click 'Logging and Profiling' in the 'Administration' section of the left-hand panel.
    (info) You need to have System Administrator permissions in order to perform this function.
  2. 以下に示すように、「ログとプロファイル作成の構成」画面が表示されます。Confluence の稼働中に次のガイドラインを使用してログ作成動作を変更します。
    • ログとプロファイル作成の構成」 — 「 ページリクエスト プロファイル作成」を参照してください。
    • 'SQL Logging' — Click the 'Enable SQL Logging' button to log the details of SQL requests made to the database.
      (info) If you need to enable logging of SQL parameter values, you will need to change the setting in the properties file. This option is not available via the Administration Console.
    • Log4j ログ作成」' — 次のプロファイル ボタンのいずれかをクリックして、すべてのロガーを事前定義済みのプロファイルにリセットします。
      • 実稼働用」プロファイルは非常に標準的なプロファイルであり、通常の本番環境条件に推奨されます。
      • 診断用」プロファイルはより多くの情報を提供し、トラブルシューティングやデバッグに役立ちます。このため、パフォーマンスは落ちますが、ログファイルへの記録は速くなります。
    • 新規エントリの追加」 — クラスまたはパッケージ名をテキストボックスに入力して「エントリの追加」ボタンをクリックします。新しいロガーは、画面下部の「既存のレベル」の一覧に表示されます。
    • 既存のレベル」 - これらは、ご使用の Confluence インスタンスに関して現在実行中のロガーです。
      • ログ作成レベルは、「新しいレベル」ドロップダウンリストから値を選択することによって変更できます。各レベルの定義については、Apache ドキュメントをお読みください。
      • 削除」リンクをクリックして、選択したクラス/パッケージ名のログ作成を停止します。
  3. 保存」ボタンをクリックして、「既存のレベル」セクションで行った変更を保存します。



スクリーンショット: ログレベルの変更とプロファイル作成

一部の特定の Confluence ログ オプションの使用

このセクションには、必要になるかもしれない特定のログ設定に関するアドバイスがいくつか含まれています。

データベースに対する SQL リクエストの詳細のログ記録

データベースに送信される個々の SQL リクエストを記録できるように、Confluence のログを増やすことができます。これは特定の問題のトラブルシューティングに役立ちます。

2つの方法で、詳細な SQL のログ記録を有効化できます。

  • 実行時 - 上記の手順を参照してください。
  • ログ記録のプロパティ ファイルを使用 - 詳細な手順を参照してください。

各 Confluence ページへのユーザーの参照/アクセスの詳細のログ記録

ユーザーが Confluence 内のどのページにアクセスしているかを示すようにログを設定することができます。これは、ログ記録のプロパティ ファイルの介してのみ利用可能です。詳細な手順を参照してください。

関連トピック