Enabling debug logging for Security for Bitbucket

Commands to enable debug logging

curl -u admin -v -X PUT https://{bitbucket.server}/rest/api/latest/logs/logger/io.soteri/debug
CODE

where

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

  • bitbucket.server is the 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]  io.soteri Switching to log level [debug]
CODE

Commands to disable debug logging

curl -u admin -v -X PUT https://{bitbucket.server}/rest/api/latest/logs/logger/io.soteri/warn
CODE

This command is identical to the first one, except with warn 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