Bitbucket Server debug logging

On this page:

Debug logging for the Bitbucket Server instance

This section describes how to enable debug level logging in Bitbucket Server. Bitbucket Server logs can be found in <Bitbucket home directory>/log.

When using the standard Bitbucket Server distribution, logs for the Tomcat webserver that hosts Bitbucket Server can be found in <Bitbucket Server installation directory>/log.

Enabling debug logging via the UI

To enable debug logging, go to the Bitbucket Server admin area, choose Logging and Profiling (under 'Support') and select Enable debug logging.

Enabling debug logging on startup

To enable debug logging whenever Bitbucket Server is started, edit the <Bitbucket home directory>/shared/bitbucket.properties file (if this file doesn't exist then you should create it) and add the following two lines:

logging.logger.ROOT=DEBUG
logging.logger.com.atlassian.bitbucket=DEBUG

If your Bitbucket Server instance is earlier than version 3.2, the bitbucket.properties file is at the top level of the Bitbucket Server home directory.

Enabling debug logging at runtime

To enable debug logging for the root logger once Bitbucket Server has been started, run the following two commands in your terminal:

curl -u <ADMIN_USERNAME> -v -X PUT -d "" -H "Content-Type: application/json" <BASE_URL>/rest/api/latest/logs/rootLogger/debug
curl -u <ADMIN_USERNAME> -v -X PUT -d "" -H "Content-Type: application/json" <BASE_URL>/rest/api/latest/logs/logger/com.atlassian.bitbucket/debug

# e.g.
curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/logs/rootLogger/debug
curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/logs/logger/com.atlassian.bitbucket/debug

To enable debug logging for a specific logger, run the following command in your terminal:

curl -u <ADMIN_USERNAME> -v -X PUT -d "" -H "Content-Type: application/json" <BASE_URL>/rest/api/latest/logs/logger/<LOGGER_NAME>/debug

# e.g. embedded Crowd debug log
curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/logs/logger/com.atlassian.crowd/debug
 
# e.g. LDAP debug log
curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/logs/logger/com.atlassian.crowd.directory.SpringLDAPConnector/DEBUG
# e.g. email debug log
curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/logs/logger/bitbucket.mail-log/debug

Profiling logging for the Bitbucket Server instance

This section describes how to enable profiling in Bitbucket Server. This log is essential when troubleshooting performance issues. Bitbucket Server logs can be found in <Bitbucket home directory>/log.

When using the standard Bitbucket Server distribution, logs for the Tomcat webserver that hosts Bitbucket Server can be found in <Bitbucket Server installation directory>/log.

Enabling profiling logging via the UI

To turn on detailed trace information,  go to the Bitbucket Server admin area, choose Logging and Profiling (under 'Support') and select Enable profiling.

Debug logging for Git operations on the client

Atlassian Support might request DEBUG logs for Git operations (on the client) when troubleshooting issues. You can enable DEBUG logging on the Git client by setting the following variables. If you are using HTTP/S please do remove the Authorization header from the output as it will contain your Basic-Auth information. Atlassian provides a set of scripts that simplify the collection of git client debug information.

On Linux

Execute the following on the command line before executing the Git command:

export GIT_TRACE_PACKET=1
export GIT_TRACE=1 
export GIT_CURL_VERBOSE=1

 

To measure the length of time a command takes to complete, use the time utility/command prior to the actual git command. For example, to test a push to branch "master":

time git push origin master

On Windows

Execute the following on the command line before executing the Git command:

set GIT_TRACE_PACKET=1
set GIT_TRACE=1 
set GIT_CURL_VERBOSE=1

Setting GIT_CURL_VERBOSE is only useful for connections over HTTP/S since SSH doesn't use the libcurl library.

Debug logging for the Bitbucket Server Backup Client

Atlassian Support might request DEBUG logs for the Backup client when troubleshooting issues.

You can enable DEBUG logging on the Backup client by adding a file named logback.xml to your working directory (pwd) with the following content:

logback.xml
<included><logger name="com.atlassian.bitbucket" level="DEBUG"/></included>


 

Last modified on Sep 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.