Enabling debug logging for Security for Bitbucket

Command to enable debug logging
curl -u admin -v -X PUT https://{bitbucket.server}/rest/api/latest/logs/logger/com.mohami/debug

  • admin is your Bitbucket admin user (you’ll be prompted for a password)

  • bitbucket.server is URL of your Bitbucket server

If the command is successful, you will see a log line like this in the Bitbucket logs:

[INFO] 2020-08-31 17:41:24,555 WARN  [hz.hazelcast.event-3]  com.mohami Switching to log level [debug]
CODE

Command to disable debug logging
curl -u admin -v -X PUT https://{bitbucket.server}/rest/api/latest/logs/logger/com.mohami/info

  • This command is identical to the first one, except with info instead of debug at the end.

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
CODE

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
CODE