400
Chapter 18: Debugging and Troubleshooting Applications
Controlling debugging information in CFML
The following sections describe how you can use CFML tags and functions to display or hide
debugging and tracing information.
Generating debugging information for an individual query
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:
•
If Database Activity is selected in the Administrator, specify
debug="No"
to prevent
ColdFusion from displaying the query’s SQL and statistics in the debugging output.
•
If Database Activity is not selected in the Administrator, specify
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="CompanyInfo" 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.
Controlling debugging output with the cfsetting tag
Use the
cfsetting
tag
showDebugOutput
attribute to turn off debugging output for a specific
page. In the Administrator, the attribute controls debugging output
only
if the Debugging
Settings page enables debugging output. The attribute’s default value is Yes. The following tag
suppresses all debugging output for the current page:
<cfsetting showDebugOutput="No">
You can put this tag on your Application.cfm page to suppress all debugging output for an
application, and override it on specific pages by setting
showDebugOutput="Yes"
in
cfsetting
tags on those pages. Conversely, you can leave debugging on for the application, and use the
cfsetting showDebugOutput="No"
tag to suppress debugging on individual pages where the
output could cause errors or confusion.
You can also use the
showDebugOutput
attribute to control debugging output if you do not have
access to the ColdFusion MX Administrator, but only if the Administrator enables debugging.
Using the IsDebugMode function to run code selectively
The
IsDebugMode
function returns True if debugging is enabled. You can use this function in a
cfif
tag condition to selectively run code only when debugging output is enabled. The
IsDebugMode
function lets you tell ColdFusion to run
any
code in debug mode, so it provides
more flexibility than the
cftrace
tag for processing and displaying information.
Содержание ColdFusion MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...