Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-32751

Improve Confluence's SQL Logging button in Logging and Profiling

      Currently, the Enable SQL Logging button in Logging and Profiling sets net.sf.hibernate.SQL to DEBUG, which logs the SQL queries, but it does not log the parameters, so you will see entries like this:

      2014-02-27 09:37:46,834 DEBUG [scheduler_Worker-8] [net.sf.hibernate.SQL] log insert into BANDANA (BANDANACONTEXT, BANDANAKEY, BANDANAVALUE, BANDANAID) values (?, ?, ?, ?)
      

      These are not very useful without the parameters. To set the parameters, we must edit the log4j.properties manually and restart the instance. This is not possible on OnDemand due to the environment's configuration, so SQL logging with trace cannot be enabled at all.

      Improve the button so that it logs parameters as well.

            [CONFSERVER-32751] Improve Confluence's SQL Logging button in Logging and Profiling

            We have managed to resolve this without a patch to Hibernate, so the changes required for this are all in core. They will be released in Confluence 5.9.11 (which just to clarify, will NOT involve a bump of Hibernate).

            Denise Unterwurzacher [Atlassian] (Inactive) added a comment - We have managed to resolve this without a patch to Hibernate, so the changes required for this are all in core. They will be released in Confluence 5.9.11 (which just to clarify, will NOT involve a bump of Hibernate).

            That is correct, and that is why this issue hasn't progressed for a while. To resolve this, we need to patch and release a new version of Hibernate, which is not a simple task.

            Denise Unterwurzacher [Atlassian] (Inactive) added a comment - - edited That is correct, and that is why this issue hasn't progressed for a while. To resolve this, we need to patch and release a new version of Hibernate, which is not a simple task.

            David Mason (Inactive) added a comment - - edited

            Due to this code in Hibernate (NullableType class), enabling TRACE without a restart is impossible:

            	private static boolean IS_TRACE_ENABLED;
            	static {
            		//cache this, because it was a significant performance cost
            		IS_TRACE_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
            	}
            

            This is mentioned on the instructions page here:

            Note: due to caching in net.sf.hibernate.type.NullableType, requires restart to take effect

            David Mason (Inactive) added a comment - - edited Due to this code in Hibernate (NullableType class), enabling TRACE without a restart is impossible: private static boolean IS_TRACE_ENABLED; static { //cache this , because it was a significant performance cost IS_TRACE_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type. class. getName() ) ).isTraceEnabled(); } This is mentioned on the instructions page here: Note: due to caching in net.sf.hibernate.type.NullableType, requires restart to take effect

            This feature would be helpful to see how long SQL queries are taking to return to Confluence, as it is sometimes not obvious from analytic tools on the DB side (if such tools are in place at all).

            Especially in the case when troubleshooting non-performant functionality, this is usually only useful if you can toggle it on/off on-the-fly, as restarting Confluence (to put in the logging) often makes whatever problem you're troubleshooting go away.

            Robert Chang added a comment - This feature would be helpful to see how long SQL queries are taking to return to Confluence, as it is sometimes not obvious from analytic tools on the DB side (if such tools are in place at all). Especially in the case when troubleshooting non-performant functionality, this is usually only useful if you can toggle it on/off on-the-fly, as restarting Confluence (to put in the logging) often makes whatever problem you're troubleshooting go away.

            +1, the ability to enable/disable TRACE level logging from the UI that shows SQL parameter values would greatly improve the usefulness of SQL logging.

            Having to shut down Confluence and follow https://confluence.atlassian.com/display/DOC/Enabling+Detailed+SQL+Logging is clunky and is hard for mission-critical environments to do on-the-fly troubleshooting.

            Robert Chang added a comment - +1, the ability to enable/disable TRACE level logging from the UI that shows SQL parameter values would greatly improve the usefulness of SQL logging. Having to shut down Confluence and follow https://confluence.atlassian.com/display/DOC/Enabling+Detailed+SQL+Logging is clunky and is hard for mission-critical environments to do on-the-fly troubleshooting.

              dunterwurzacher Denise Unterwurzacher [Atlassian] (Inactive)
              dunterwurzacher Denise Unterwurzacher [Atlassian] (Inactive)
              Affected customers:
              3 This affects my team
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: