Enable SQL query logging in Bitbucket Server or Data Center
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
要約
For troubleshooting purposes, it may be necessary to enable SQL query and parameter logging to review the queries that Bitbucket runs.
This article describes procedures for enabling them.
ソリューション
Bitbucket versions >= 5.0
During Runtime
Enabling SQL query logging at runtime
This method enables the debug log level for SQL queries at runtime, without the need of restarting Bitbucket Server. More details are provided on the Enable debug logging page.
curl -X PUT -u <ADMIN_USERNAME> <BASE_URL>/rest/api/latest/logs/logger/org.hibernate.SQL/debug
Use the following to disable the debug log level by setting it back to warn:
curl -X PUT -u <ADMIN_USERNAME> <BASE_URL>/rest/api/latest/logs/logger/org.hibernate.SQL/warn
Enabling SQL parameter logging at runtime
This may log sensitive information (user names, group names, project names, etc).
This method enables the trace log level for logging the query parameters at runtime, without the need of restarting Bitbucket Server. More details are provided on the Enable debug logging page.
curl -X PUT -u <ADMIN_USERNAME> <BASE_URL>/rest/api/latest/logs/logger/org.hibernate.type/trace
Use the following to disable the trace log level by setting it back to warn:
curl -X PUT -u <ADMIN_USERNAME> <BASE_URL>/rest/api/latest/logs/logger/org.hibernate.type/warn
At Startup
Enabling SQL query logging at startup
Add the following to the $BITBUCKET_HOME/shared/bitbucket.properties
file followed by a restart.
logging.logger.org.hibernate.SQL=debug
To disable, just remove the line followed by a restart.
Enabling SQL parameter logging at startup
This may log sensitive information (user names, group names, project names, etc).
Add the following to the $BITBUCKET_HOME/shared/bitbucket.properties
file followed by a restart.
logging.logger.org.hibernate.type=trace
To disable, just remote the line followed by a restart.
Bitbucket versions < 5.0
Use the following procedures for versions earlier than 5.0: