User Guide

Table Of Contents
322 Chapter 14: Handling Errors
Reviewing the code
The following table describes the highlighted code and its function:
A log file entry similar to the following is generated if you try to call a nonexistent custom tag and
this page catches the error (line breaks added for clarity):
"Error","web-13","12/19/01","11:29:07",MYAPP,"Exception error --
Exception type: coldfusion.runtime.CfErrorWrapper
Template: /MYStuff/MyDocs/exceptiontest.cfm,
Remote Address: 127.0.0.1,
HTTP Reference:
Diagnostics: Cannot find CFML template for custom tag testCase. Cannot
find CFML template for custom tag testCase. ColdFusion attempted looking
in the tree of installed custom tags but did not find a custom tag with
this name."
The text consists of a comma-delimited list of the following entries:
Log entry type, specified by the cflog type attribute
ID of the thread that was executing
Date the entry was written to the log
Time the entry was written to the log
Application name, as specified in the Application.cfc initialization code (by setting the
This.application variable) or by a
cfapplication tag (for example, in an Application.cfm
file).
The message specified by the cflog text attribute.
Handling runtime exceptions with ColdFusion tags
Exceptions include any event that disrupts the normal flow of instructions in a ColdFusion page,
such as failed database operations, missing include files, or developer-specified events. Ordinarily,
when ColdFusion encounters an exception, it stops processing and displays an error message, or
an error page specified by a
cferror tag or the Site-wide Error Handler option on the Settings
page in the Administrator. However, you can use the ColdFusion exception handling tags to catch
and process runtime exceptions directly in ColdFusion pages.
Code Description
<cflog type=”Error”
file="myapp_errors"
text="Exception error
Exception type: #Error.type#
Template: #Error.template#,
Remote Address:
#Error.remoteAddress#,
HTTP Reference: #error.HTTPReferer#
Diagnostics: #Error.diagnostics#">
When this page is processed, log an entry in the file
myapp_errors.log file in the ColdFusion log directory.
Identify the entry as an error message and include an
error message that includes the exception type, the
path of the page that caused the error, the remote
address that called the page, and the error’s
diagnostic message.