You can use the
enabled. Because you 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="CompanyInfo">
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>
Tip: If you use
cfdump
example <cfif IsDebugMode()><cfdump var=#myVar#></cfif>. This way you ensure that if
you leave any cfdump tags in 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
cftrace
the
tag executes. You use it to provide "snapshots" of specific information as your
cftrace
application runs.
About the cftrace tag
The
tag provides the following information:
cftrace
•
A severity identifier specified by the
•
A timestamp indicating when the
•
The time elapsed between the start of processing the request and when the current
executes.
•
The time between any previous
first
cftrace
not display this information in inline trace output, only the log and in the standard debugging
output.
•
The name of the page that called the
•
The line on the page where the
•
A trace category specified by the
•
A message specified by the
•
The name and value, at the time the
attribute
var
A typical
cftrace
<cftrace category="UDF End" inline = "True" var = "MyStatus"
text = "GetRecords UDF call has completed">
You can display the
•
As a section in the debugging output
output, in the Administrator, select Tracing Information on the Debugging Settings page.
function to selectively log information only when debugging is
IsDebugMode
tags frequently for debugging, put them in <cfif IsDebugMode()> tags; for
cftrace
cftrace
tag processed for the request, the output indicates "1st trace". ColdFusion does
cftrace
category
attribute
text
tag might look like the following:
tag output in either or both of the following ways:
cftrace
tag
attribute
cftrace
type
tag executed
tag in the request and the current one. If this is the
tag
cftrace
call is located
attribute
call executes, of a single variable specified by the
cftrace
To display the trace information in the debugging
Using the cftrace tag to trace execution
tag
cftrace
401
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers