How to enable debug logging for Bitbucket Mesh

お困りですか?

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

コミュニティに質問

プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。

このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

要約

When troubleshooting Bitbucket Mesh and/or Bitbucket Mesh Sidecar, we may need to increase the logging level and enable additional logging to capture the full interaction. Depending on the issue, we may want to increase the logging level of a specific class, capture all logging at a higher level, or update logging at startup. Because Mesh receives its configuration from Bitbucket, this page will describe how to update logging during startup and also while the application is running.

環境

Bitbucket 8.x onwards

ソリューション

DEBUG logging at runtime

If we are experiencing an ongoing issue but the services are online, we can adjust the logging level on the fly by performing the following steps: 

ランタイム

1. Edit the bitbucket.properties file and add the properties

mesh.logging.logger.com.atlassian.bitbucket.mesh=DEBUG
mesh.logging.logger.com.atlassian.bitbucket.mesh.process.OsProcess=DEBUG
mesh.logging.logger.io.grpc=DEBUG
mesh.profiling.enabled=true

Note the prefix

When adding these properties to the bitbucket.properties  file, we MUST include the 'mesh' prefix.

2. Use the Mesh Config Refresh endpoint

curl -iv -u $ADMIN:$ADMIN_PWD -X POST -H "Content-Type: application/json" $BASE_URL/rest/ui/admin/git/mesh/config/refresh

When run, this endpoint will check bitbucket.properties for a list of properties and propagate changes to the Mesh Nodes (Remote and Sidecar) to take effect immediately. You can confirm if it worked by seeing the below in the atlassian-mesh.log file in <Bitbucket-home>/mesh/log directory:

INFO  [main] - ROOT Switched to log level [DEBUG]
INFO  [main] - c.a.bitbucket.mesh.process.OsProcess Switched to log level [DEBUG]
INFO  [main] - io.grpc Switched to log level [WARN]

Disable the Mesh debug

Follow the below steps to disable the Mesh debug and profiler logs after you're done troubleshooting:

Disable Mesh debug

1. Edit the bitbucket.properties file and add the properties:

mesh.logging.logger.com.atlassian.bitbucket.mesh=INFO
mesh.logging.logger.com.atlassian.bitbucket.mesh.process.OsProcess=INFO
mesh.logging.logger.io.grpc=INFO
mesh.profiling.enabled=false

2. Use the Mesh Config Refresh endpoint to refresh and apply the above properties without restarting Bitbucket

curl -iv -u $ADMIN:$ADMIN_PWD -X POST -H "Content-Type: application/json" $BASE_URL/rest/ui/admin/git/mesh/config/refresh

When run, this endpoint will check bitbucket.properties for a list of properties and propagate changes to the Mesh Nodes (Remote and Sidecar) to take effect immediately. 

You can confirm if it worked by seeing the below in the atlassian-mesh.log file in <Bitbucket-home>/mesh/log directory:

INFO  [grpc-server:thread-586] "ManagementService/SetConfiguration" (>1 <0) com.atlassian.bitbucket.mesh Switched to log level [INFO]
INFO  [grpc-server:thread-586] "ManagementService/SetConfiguration" (>1 <0) io.grpc Switched to log level [INFO]
INFO  [grpc-server:thread-586] "ManagementService/SetConfiguration" (>1 <0) c.a.b.m.c.DefaultProfilingConfig Profiling has been disabled

DEBUG logging on start-up

If we are experiencing a failure during startup such as Mesh Sidecar failing to initialize, the updated logging configuration may never get sent or received. If this occurs, we can perform the following steps: 

Start-up

1. Edit the mesh.properties file

Mesh Profile場所
Mesh Sidecar$BITBUCKET_HOME/mesh/mesh.properties /var/atlassian/application-data/bitbucket/mesh/mesh.properties 
Remote Mesh$MESH_HOME/mesh.properties /var/atlassian/application-data/mesh/mesh.properties 

2. Add the logging properties and level

# The base Mesh logger
logging.logger.com.atlassian.bitbucket.mesh=DEBUG

# Mesh gRPC Logger
logging.logger.io.grpc=WARN

# Mesh Git Operations
logging.logger.com.atlassian.bitbucket.mesh.process.OsProcess=DEBUG

# Enable Mesh Profiler Logs
profiling.enabled=true

3. Restart the JVM and check the logs

Within the logs, we should see messages indicating that the log level has been updated:

INFO  [main] - ROOT Switched to log level [DEBUG]
INFO  [main] - c.a.bitbucket.mesh.process.OsProcess Switched to log level [DEBUG]
INFO  [main] - io.grpc Switched to log level [WARN]





最終更新日 2024 年 4 月 12 日

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

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