ログ作成の設定
特に、特定の問題のトラブルシューティング時に Confluence アプリケーション ログに書き込まれる内容を変更する必要があるなど、さまざまな状況があります。
Confluence の実行中に、[ロギングとプロファイリング] 画面でログ作成動作を一時的に変更できます。Confluence を再起動すると、変更は破棄されます。
Alternatively, you can permanently change the logging behaviour in the log4j configuration file, log4j2.xml .
Confluence 11.0 and later: Confluence uses a native Apache Log4j 2 configuration file, log4j2.xml . The Log4j 1 log4j.properties and log4j-diagnostic.properties files, and the burstFilterConfig.properties file, are no longer read. If you customized any of these files in an earlier version, you must recreate your changes in log4j2.xml .
On this page:
Terminology: In log4j 2, a 'logger' is a named entity. Logger names are case-sensitive and they follow a hierarchical naming standard. For example, the logger named com.foo is a parent of the logger named com.foo.bar.
Confluence 動作中にログ作成動作を一時的に変更する
問題のトラブルシューティングを行う場合、Confluence の実行中にログ作成動作を一時的に変更できます。これらの変更は log4j2.xml ファイルには書き込まれないため、Confluence を次回停止したときに破棄されます。
既存のクラスまたはパッケージのログ レベルを変更する
これを実行するには、システム管理者グローバル権限が必要です。特定のレベルについては、「4j ログ作成レベル 」を参照してください。
既存のクラスまたはパッケージのログ レベルを変更するには、次の手順を実行します。
- [管理] メニュー に移動して、[一般設定] > [ログとプロファイルの作成] の順に選択します。
- Confluence をクラスタで実行する場合は、クラスタ ノードを選択します。
- 関連するクラスまたはパッケージを探し、[New Level (新しいレベル)] ドロップダウンから値を選択します。
- 変更を [保存] します。
または、特定のクラスまたはパッケージのログ作成を停止する場合は、[削除] を選択します。
変更は log4j.properties ファイルには書き込まれないため、Confluence を次回停止したときに破棄されます。
追加のクラスまたはパッケージのログ作成を追加する
Atlassian のサポート チームは、特定の問題のトラブルシューティングを行う際、追加のログ作成を有効にするように依頼する場合があります。これを実行するには、システム管理者グローバル権限が必要です。
新しいクラスまたはパッケージのログ レベルを設定するには、次の手順を実行します。
- [管理] メニュー に移動して、[一般設定] > [ログとプロファイルの作成] の順に選択します。
- Confluence をクラスタで実行する場合は、クラスタ ノードを選択します。
- [クラス/パッケージ名] フィールドに名前を入力します。これは
com.atlassian.confluence.exampleのようになります。 - [エントリの追加] を選択して、新しいクラスまたはパッケージをリストに追加します。
- 関連するクラスまたはパッケージを探し、[New Level (新しいレベル)] ドロップダウンから値を選択します。
- 変更を保存します。
ページ プロファイル作成のオンまたはオフ
ページ プロファイリングの使用タイミングと使用方法の詳細は、「ページ リクエスト プロファイリングを使用してパフォーマンス低下をトラブルシューティングする」を参照してください。
詳細な SQL ログ作成のオンまたはオフ
詳細な SQL ログ作成の使用タイミングと使用方法の詳細は、「詳細 SQL ログ作成の有効化」を参照してください。
事前設定されたログ作成構成
Confluence では、事前設定された 2 つのログ構成方法を提供します。
- 本番環境
これは推奨されるデフォルト設定で、ログをフラッディングすることなく最も重要な情報を提供することを目的としています。 - 診断
これは、ほとんどのパッケージのログ レベルをデバッグに変更します。トラブルシューティング時には便利ですが、パフォーマンスが低下し、ログファイルがより迅速にいっぱいになります。
ログ作成構成をデフォルトにリセットする場合は、[本番環境] を選択します。
スクリーンショット: ログレベルの変更とプロファイル作成
Permanently change logging level in the configuration XML file
これを行うには、インストール ディレクトリにアクセスする必要があります。
log4j2.xml ファイルには、すべてのデフォルトのクラスとパッケージ、および有効にするように選択できる追加のパッケージが一覧表示されます。
クラスまたはパッケージのログ レベルを永続的に変更するには、次の手順を実行します。
- Confluence を停止します。
<CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/log4j2.xmlファイルを編集します。- In the
<Loggers>section, locate the<Logger>element for the package you want to change. If the element is commented out, remove the surrounding<!--and-->to enable it. - Change the logging level to DEBUG, INFO, WARN, ERROR, or FATAL. See log4j Logging Levels for accepted values. For example:
<Logger level="debug" name="com.atlassian.confluence.cache"/> - ファイルを保存し、Confluence を再起動して変更を有効にします。
If a logger also has additivity="false" and an <AppenderRef> , its messages go only to that appender's log file. Keep these when you change the level. For example, this logger writes only to atlassian-confluence-index.log :
<Logger level="info" name="com.atlassian.confluence.internal.index" additivity="false">
<AppenderRef ref="indexlog"/>
</Logger>
Confluence をクラスタで実行している場合は、すべてのノードで変更を繰り返す必要があります。各ノードを 1 つずつ下げることができます。クラスタ全体を停止する必要はありません。
If you want to log a class or package that's not already listed, simply add it to the file. See the log4j 2 documentation for more information.
ログの場所、番号、サイズを変更する場合は、「Confluence ログを使用する」を参照してください。
logging.properties で java.util.logging のレベルを設定する
Confluence では、log4j や slf4j ではなく java.util.logging を使用するライブラリをいくつか使用しています。該当するライブラリは以下のとおりです。
- com.sun.jersey
- org.apache.shindig
Confluence の logging.properties ファイルは、特定のレベルの java.util.logging を slf4j 経由で log4j にリダイレクトするように設定されています。
これらのライブラリのログ レベルを上げるには、まず <CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/ にある logging.properties ファイルを設定する必要があります。ログ レベルは log4j とは異なります。詳細な手順については、Java 11 ドキュメントの java.util.logging を参照してください。
たとえば、shindig のログ レベルを上げるには、logging.properties ファイル内の次の行を変更します。
org.apache.shindig.level = INFO
to
org.apache.shindig.level = FINE
その後、同様に上述のいずれかの方法を使用して log4j レベルを設定します。
ロガーのバースト制限を設定する
Confluence allows burst limiting on loggers by using the log4j 2 BurstFilter implementation. Learn more about this mechanism
Confluence 11.0 and later: burst limiting is configured directly in log4j2.xml . The burstFilterConfig.properties file used in earlier versions is no longer read.
特定のロガーにバースト制限を追加するには、次の手順を実行します。
- Confluence を停止します。
- \
<CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/log4j2.xmlファイルを編集します。 In the
<Loggers>section, add a<BurstFilter>element inside the<Logger>element for the logger you want to limit. If there is no<Logger>element for it yet, add one. Use the following configuration as an example, where:
-nameis the class or package name of the logger.
-levelis the log level at which we filter logs. Anything at or below this level is subject to filtering.
-rateis the average number of events we allow per second.
-maxBurstis the maximum number of events that can occur before filtering starts.<Logger name="{loggerName}"> <BurstFilter level="WARN" rate="0.5" maxBurst="5"/> </Logger>For example, Confluence ships with this configuration:
<Logger name="com.atlassian.analytics.client.pipeline.PipelineExecutionService"> <BurstFilter level="WARN" rate="0.5" maxBurst="5"/> </Logger>- ファイルを保存し、Confluence を再起動して変更を有効にします。
