User Guide

202 Chapter 11 Preventing and Handling Errors
Example of a validation error page
The following example shows a custom error page for a validation error:
<html>
<head>
<title>Products - Error</title>
</head>
<body>
<h2>Oops</h2>
<p>You failed to correctly complete all the fields
in the form. The following problems occurred:</p>
#error.invalidFields#
</body>
</html>
Logging Errors
ColdFusion Server provides extensive capabilities for generating, managing, and
viewing log files, as described in Advanced ColdFusion Administration.
ColdFusion automatically logs errors to the default logs in the following cases:
If you use the default error handlers
If a cferror handler of type Request handles the error
Otherwise you must use the
cflog tag in your error handling code to generate log
entries.
The cflog tag lets you specify the following information:
A custom file or standard ColdFusion log file in which to write the message.
Text to write to the log file.
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
cflog tag in an exception error page to log the error
information to an application-specific log file.
<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.