Enable SQL query logging

'How Do I...' and 'How to...' Guide to Stash

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Enabling SQL query logging

  1. Create a file <STASH_HOME>/logback.xml with the following text in it:

    <logger name="org.hibernate.SQL" level="DEBUG"/>
  2. Restart your Stash server.
  3. Look for org.hibernate.SQL logging lines in <STASH_HOME>/log/atlassian-stash.log such as:

    2014-12-04 19:39:39,749 DEBUG [clusterScheduler_Worker-8]  
    org.hibernate.SQL delete sta_activity_0 from sta_activity 
    sta_activity_0  inner join HT_sta_pr_rescope_activity 
    HT_sta_pr_rescope_activity_0 on sta_activity_0.id=HT_sta_pr_rescope_activity_0.activity_id

Enabling parameter logging

This may log sensitive information (user names, group names, project names, etc).

SQL queries are parameterized with ?. If you need to see the parameter data, you can enable parameter logging by changing the logback.xml file as below.

<logger name="org.hibernate.SQL" level="DEBUG"/>
<logger name="org.hibernate.type" level="TRACE"/>
Last modified on Dec 5, 2014

Was this helpful?

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