Enabling debug logging
Should you have issues with Security for Bitbucket, turning on debug logging can help to troubleshoot and diagnose them.
Additional Logging Setting
In the plugin configuration, you can enable additional logging under the Security for Bitbucket Settings heading by toggling the Enable additional logging switch.
![](../../__attachments/14814773300/localhost_7990_bitbucket_plugins_servlet_security-for-bitbucket-settings.png?inst-v=dd2e15ff-a066-4891-84cc-df8425dc8a25)
Security for Bitbucket Settings page, with a switch labeled Enable additional logging, just above the Global Scanning Rules heading.
This makes all Debug and Info level messages log as Warn messages on all nodes until the setting is turned off.
If you want to include Trace messages as well, you can use the REST API for Scripting and Automation and set the logLevelOverride
to TRACE
. When you do this, the Enable additional logging switch will show as on in the settings panel; toggling the switch after this will reset the logLevelOverride
to WARN
(the default), and toggling the switch yet again will reset to DEBUG
. Trace logging settings set by the API can only be restored by the API if changed in the settings configuration panel.
Interaction With Bitbucket Logging Configuration
Bitbucket allows more granular configuration of logging. Soteri recommends using the “Enable additional logging” setting to troubleshoot any issue with Security for Bitbucket. However, if for any reason you decide to use the Bitbucket logging configuration, it will not conflict with the Additional Logging Setting.
Enabling trace logging for database SQL commands
Similar to turning on debug logging for the Security for Bitbucket plugin, trace level logging to see raw SQL commands to the Bitbucket database can be enabled by setting the log level for the following packages:
curl -X PUT -u admin https://{bitbucket.server}/rest/api/latest/logs/logger/org.hibernate.sql/trace
curl -X PUT -u admin https://{bitbucket.server}/rest/api/latest/logs/logger/net.java.ao.sql/trace
curl -X PUT -u admin https://{bitbucket.server}/rest/api/latest/logs/logger/com.querydsl.sql/trace
and can be undone by setting the log levels back to info
:
curl -X PUT -u admin https://{bitbucket.server}/rest/api/latest/logs/logger/org.hibernate.sql/info
curl -X PUT -u admin https://{bitbucket.server}/rest/api/latest/logs/logger/net.java.ao.sql/info
curl -X PUT -u admin https://{bitbucket.server}/rest/api/latest/logs/logger/com.querydsl.sql/info