Enabling SQL logging in JIRA
Similar to access logs, another useful piece of logging, especially when debugging an issue, is SQL logging. In this recipe, we will see how to turn on SQL logging.
How to do it...
SQL logging cannot be turned ON from the user interface. Instead, it can be turned ON in the WEB-INF/classes/log4j.properties
file as we have seen with access logs. In this case, the logging entry to be modified is as follows:
log4j.logger.com.atlassian.jira.ofbiz.LoggingSQLInterceptor = ON, sqllog log4j.additivity.com.atlassian.jira.ofbiz.LoggingSQLInterceptor = false log4j.logger.com.atlassian.jira.security.xsrf.XsrfVulnerabilityDetectionSQLInterceptor = ON, xsrflog log4j.additivity.com.atlassian.jira.security.xsrf.XsrfVulnerabilityDetectionSQLInterceptor = false
The latter logs the SQL queries executed for Xsrf vulnerability detection.
How it works...
Once turned ON, the SQL logs will be written to atlassian-jira-sql.log
file under logs folder.
You can find details of numerous SQLs executed...