How to Enable Detailed SQL Logging
プラットフォームについて: 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 は除く
要約
Bamboo uses the open-source persistence framework Hibernate. This page tells you how to configure Bamboo's logging to report individual SQL requests that are sent to the database by Hibernate. It is useful for troubleshooting the following events:
- Database Corruption
- Exceptions caused by an illegal database operation
- Any Database specific error(s)
環境
All supported versions of Bamboo.
ソリューション
It is advisable to enable detailed SQL logging before sending us the log files so, after you have enabled enhanced logging, please replicate the action that was causing the error in the first place and then generate a Support Zip. This will assist us in determining what SQL queries were running during the reported problem.
Enabling detailed SQL logging greatly increases the amount of log output produced, potentially resulting in increased disk usage. Ensure you have sufficient disk space available and disable detailed SQL logging once you no longer need it.
Enabling SQL logging using Log4j
Bamboo versions 7.x
- Stop Bamboo.
- Edit the
log4j.properties
file located in<bamboo-install>/atlassian-bamboo/WEB-INF/classes
Add the following lines to
log4j.properties
:log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=TRACE log4j.logger.org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl=TRACE
- Start Bamboo
Bamboo versions 8.x
Bamboo 8.x series uses a different logging strategy that requires changes to <bamboo-home>/bamboo.cfg.xml
. Adding debug classes for hibernate will not work on the UI or log4j.properties
- Stop Bamboo.
Add the following properties to
<bamboo-home>/bamboo.cfg.xml
:<property name="hibernate.format_sql">true</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.use_sql_comments">true</property>
- Start Bamboo
- The queries output will be sent to either on
<bamboo-install>/logs/catalina.out
or on the standard output in the case of running Bamboo in Docker for example
Bamboo versions 9.x
- Stop Bamboo.
- Edit
log4j2.properties
, located in<bamboo-install>/atlassian-bamboo/WEB-INF/classes
. Add the following lines to
log4j2.properties
:logger.bamboo-binder.level=TRACE logger.bamboo-binder.name=org.hibernate.type.descriptor.sql.BasicBinder logger.bamboo-registry.level=TRACE logger.bamboo-registry.name=org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl
- Start Bamboo
Enabling SQL logging in the Bamboo UI
- Only valid for Bamboo 7.x and 9.x
- Access Administration > Overview > Log settings
Add the following log settings:
Classpath タイプ org.hibernate.type.descriptor.sql.BasicBinder
すべて org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl
すべて
Disable Batched Updates
- Stop Bamboo
Edit
<bamboo-home>/bamboo.cfg.xml
and add the followinghibernate.jdbc.batch_size
property line:<application-configuration> ... <properties> ... <property name="hibernate.jdbc.batch_size">0</property> ... </properties> </application-configuration>
- Start Bamboo.