ColdFusion MX Professional Projects

The Administrator settings provide debugging information for every page requested by the browser. You can change these debug settings by using the Debug menu page of ColdFusion Administrator, shown in Figure 14.3.

Figure 14.3: The Debug menu page of ColdFusion Administrator.

The options on this page are

Debugging the IP Address Page

You can use the Debugging IP Addresses menu of ColdFusion Administrator to ensure that debugging output is available to all local end users. You can add to or restrict the addresses that can view this information. To enforce strict security, you can limit this information to ColdFusion Administrator or original developers. Figure 14.4 displays the Debugging IP Address menu of the ColdFusion Administrator page.

Figure 14.4: The Debugging IP Address menu of the ColdFusion Administrator page.

Type the IP address in the text box, and click Add to include the end user to whom you wish to display the information. Select the IP address from the list, and click Remove Selected to delete the address from the list.

You can use CFML tags and functions to set or override the debug options set in ColdFusion Administrator. For example, set the debug attribute in <cfquery> to no to override a checked database activity checkbox in ColdFusion Administrator.

The syntax for <cfquery> is

<CFQUERY NAME="queryname" DATASOURCE="datasource name" DEBUG="no"> Select * from tablename </CFQUERY>

You can also use the <cfsetting> tag to turn off debugging output for a specific page. The default value for this tag is yes. It works only if the ColdFusion Administrator Debugging settings page enables debugging output. The syntax for <cfsetting> is

<CFSETTING SHOWDEBUGOUTPUT="NO">

You can use the IsDebugMode function to check whether debugging is enabled or not. This provides more flexibility to the <cftrace> tag.

Using the <cftrace> Tag

You can use this tag to log and display debugging information at runtime. The <cftrace> tag executes only if the Enable Debugging option is checked in ColdFusion Administrator. The output of this tag is logged in logs/cftrace.log under the ColdFusion installation directory. You can use this tag to trap the values of internal variables, data structures, and intermediate results at runtime. This helps you to identify the root cause of an error. You can display the output of <cftrace> as a section in debugging output or inline in your application.

Note

If <cftrace> is placed inside the <cfsilent> block, ColdFusion doesn't display the trace information inline but includes it in the standard debugging display.

These are the attributes of <cftrace>:

The syntax for <cftrace> is

<CFTRACE ABORT="FALSE" CATEGORY="structures " INLINE="TRUE" TEXT="error description "VAR="myvar">

Категории