Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 390

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
The
attribute can be useful to disable query debugging information generated by queries in custom tags that
debug
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
tag.
cfstoredproc
Controlling debugging output with the cfsetting tag
Use the
tag
cfsetting
showDebugOutput
controls debugging output only if the Debugging Settings page in the ColdFusion Administrator enables debugging
output. The default value of the attribute is Yes. The following tag suppresses all debugging output for the current page:
<cfsetting showDebugOutput="No">
You can put this tag in the initialization code of the Application.cfc file or on your Application.cfm page to suppress
all debugging output for an application, and override it on specific pages by setting
tags on those pages. Conversely, you can leave debugging on for the application, and use the
cfsetting
tag to suppress debugging on individual pages where the output could cause errors or
showDebugOutput="No"
confusion.
You can also use the
showDebugOutput
ColdFusion Administrator, but only if the Administrator enables debugging.
Using the IsDebugMode function to run code selectively
The
function returns True if debugging is enabled. You can use this function in a
IsDebugMode
selectively run code only when debugging output is enabled. The
run any code in debug mode, so it provides more flexibility than the
information.
You can use the
IsDebugMode
control the log output, you have the flexibility of silently logging information without displaying trace information in
the browser. For example, the following code logs the application page, the current time, and the values of two variables
to the log file MyAppSilentTrace.log when debugging is enabled:
<cfquery name="MyDBQuery" datasource="cfdocexamples">
SELECT *
FROM Employee
</cfquery>
<cfif IsDebugMode()>
<cflog file="MyAppSilentTrace" text="Page: #cgi.script_name#,
completed query MyDBQuery; Query Execution time:
#cfquery.ExecutionTime# Status: #Application.status#">
</cfif>
If you use
tags frequently for debugging, place them in
cfdump
IsDebugMode()><cfdump var=#myVar#></cfif>
production code, they are not displayed when you disable debugging output.
Using the cftrace tag to trace execution
The
tag displays and logs debugging data about the state of your application at the time the
cftrace
executes. You use it to provide "snapshots" of specific information as your application runs.
attribute to turn off debugging output for a specific page. The attribute
attribute to control debugging output if you do not have access to the
function to selectively log information only when debugging is enabled. Because you
. This way you ensure that if you leave any
Last updated 1/20/2012
attribute in the
debug
showDebugOutput="Yes"
function lets you tell ColdFusion to
IsDebugMode
tag for processing and displaying
cftrace
tags; for example
<cfif IsDebugMode()>
385
in
cfsetting
tag condition to
cfif
<cfif
tags in
cfdump
tag
cftrace

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents