How to enable debug logging for Bitbucket Apps?

Debug logs of the specific app help us much in reproducing and understanding potential issues with our apps.

If you submit a bug report, please try to attach a log from Bitbucket, with enabled debugging for corresponding app.

Enabling debug logging for Bitbucket itself, does NOT enable debug logging for installed apps! But app log is also part of Bitbucket log, incl. log rotation.


1. Enable debug logging for Bitbucket Server app

Enable debug logging level for a specific app like follows:

$ curl -u <YOUR_USER> -v -X PUT -d "" -H "Content-Type: application/json" <YOUR_SERVER>/rest/api/latest/logs/logger/<PLUGIN_KEY>/debug

Replace the <PARAMETERS> with the following values: 

  • YOUR_USER: The name of your Bitbucket Server user (needs admin privileges)

  • YOUR_SERVER: The base URL of your Bitbucket Server instance
  • PLUGIN_KEY: The key of the app to enable debug logging for (key can be found in the table below, e.g. "ch.mibex.stash.cra")
Example:
$ curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://10.0.1.1/bitbucket/rest/api/latest/logs/logger/ch.mibex.stash.cra/debug


If it worked, you should get the following result:  HTTP/1.1 204 No Content

2. Reproduce your problem and collect debug log

Now you can reproduce your problem with debug logging.

Collect the debug logs from your BITBUCKET_HOME_DIRECTORY/log/atlassian-bitbucket.log file.

3. Attach the collected logs to corresponding service desk ticket.

4. Disable debug logging in the end

Reset logging level by executing the request as above, just be replacing debug with warn:

$ curl -u <YOUR_USER> -v -X PUT -d "" -H "Content-Type: application/json" <YOUR_SERVER>/rest/api/latest/logs/logger/<PLUGIN_KEY>/warn

App Keys Bitbucket Server Apps


AppApp Key
Activity Streams for Bitbucket Serverch.mibex.stash.rss4stash
Code Owners for Bitbucket Server    ch.mibex.bitbucket.codeowners
Code Review Assistant for Bitbucketch.mibex.stash.cra
Commit Finder for Bitbucket Serverch.mibex.stash.commitfinder
Create Branch Wizard for Bitbucketch.mibex.bitbucket.createbranchwizard
Issue Creator for Bitbucket Serverch.mibex.stash.issuecreator
Pull Request Analytics for Bitbucketch.mibex.bitbucket.pra
Pull Request Please for Bitbucket Serverch.mibex.stash.prp
Repository Dashboard for Bitbucketch.mibex.stash.reposummary4stash
Repository Templates for Bitbucketch.mibex.stash.templates
Suggested Changes for Bitbucketch.mibex.bitbucket.suggestedchanges4bitbucket
Include Code Quality for Bitbucket (formerly Sonar™ for Bitbucket)ch.mibex.stash.sonar4stash


SONAR™, SONARQUBE™ and SONARCLOUD™ are independent and trademarked products and services of SonarSource SA: see sonarsource.com, sonarqube.org, sonarcloud.io.