The following sections describe how you can use CFML tags and functions to display or hide debugging and tracing information.
In the Administrator, the cfquery
tag debug
attribute overrides the Database Activity setting on the Debugging Settings page. The debug
attribute has an effect only when debugging output is enabled on the Debugging Settings page, as follows:
debug="No"
to prevent ColdFusion from displaying the query's SQL and statistics in the debugging output.
debug="Yes"
or debug
to have ColdFusion display the query's SQL and statistics in the debugging output.
For example, if Database Activity is not selected in the Administrator, you can use the following code to show the query execution time, number of records returned, ColdFusion page, timestamp, and the SQL statement sent to the data source for this query only:
<cfquery
name="TestQuery" datasource="cfdocexamples"debug
>
SELECT * FROM TestTable </cfquery
>
The debug
attribute can be useful to disable query debugging information generated by queries in custom tags that you call frequently, so that you only see the debugging information for queries in pages that call the tags.
You can also view stored procedure-specific debugging information by specifying the debug
attribute in the cfstoredproc
tag.