Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 291

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
ColdFusion automatically logs errors to the default logs if you use the default error handlers. In all other cases, use the
tag in your error handling code to generate log entries.
cflog
The
tag lets you specify the following information:
cflog
• A custom file or standard ColdFusion log file in which to write the message.
• Text to write to the log file. This can include the values of all available error and
• Message severity (type): Information Warning, Fatal, or Error.
• Whether to log any of the following: application name, thread ID, system date, or system time. By default, all get
logged.
For example, you could use a
application-specific log file, as in the following page:
<html>
<head>
<title>Products - Error</title>
</head>
<body>
<h2>Sorry</h2>
<p>An error occurred when you requested this page.
The error has been logged and we will work to correct the problem.
We apologize for the inconvenience. </p>
<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#">
</body>
</html>
Reviewing the code
The following table describes the highlighted code and its function:
Code
<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#">
A log file entry like the following is generated if you try to call a nonexistent custom tag and this page catches the error
(line breaks added for clarity):
tag in an exception error-handling page to log the error information to an
cflog
Last updated 1/20/2012
cfcatch
Description
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.
286
variables.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents