User Guide

Table Of Contents
438 Chapter 18: Debugging and Troubleshooting Applications
Using tracing
As its name indicates, the
cftrace tag is designed to help you trace the execution of your
application. It can help you do any of several things:
You can time the execution of a tag or code section. This capability is particularly useful for
tags and operations that can take substantial processing time. Typical candidates include all
ColdFusion tags that access external resources, including
cfquery, cfldap, cfftp, cffile,
and so on. To time execution of any tag or code block, call the
cftrace tag before and after the
code you want to time.
You can display the values of internal variables, including data structures. For example, you can
display the raw results of a database query.
You can display an intermediate value of a variable. For example, you could use this tag to
display the contents of a raw string value before you use string functions to select a substring or
format it.
You can display and log processing progress. For example, you can put a cftrace call at the
head of pages in your application or before critical tags or calls to critical functions. (Doing this
could result in massive log files in a complex application, so you should use this technique with
care.)
If a page has many nested cfif and cfelseif tags you can put cftrace tags in each
conditional block to trace the execution flow. When you do this, you should use the condition
variable in the message or
var attribute.
If you find that the ColdFusion server is hanging, and you suspect a particular block of code
(or call to a cfx tag, COM object, or other third-party component), you can put a
cftrace tag
before and after the suspect code, to log entry and exit.
501 ms (1st trace)] The time ColdFusion took to process the current request up to the
cftrace tag, This is the first cftrace tag processed in this request. If
there had been a previous
cftrace tag, the parentheses would contain
the number of milliseconds between when the previous
cftrace tag ran
and when this tag ran.
[C:\CFusionMX7\wwwroot
\MYStuff\mydocs\
tracetest.cfm @ line: 14]
Path of the page on which the trace tag is located and the line number
of the
cftrace tag on the page.
[UDF End] Value of the
cftrace tag category attribute.
[MyStatus = Success] Name and value of the variable specified by the
cftrace tag var
attribute. If the variable is a complex data type, such as an array or
structure, the log contains the variable value and the number of entries
at the top level of the variable, such as the number of top-level structure
keys.
GetRecords UDF call has
completed
The
cftrace tag text attribute with any variables replaced with their
values.
Entry Meaning