ColdFusion provides extensive capabilities for generating, managing, and viewing log files, as described in Administering ColdFusion MX. It also provides the cflog tag which adds entries to ColdFusion logs.
ColdFusion automatically logs errors to the default logs in the following cases:
cferror handler of type Request handles the error
In all other cases, you must use the cflog tag in your error handling code to generate log entries.
The cflog tag lets you specify the following information:
cfcatch variables.
For example, you could use a cflog tag in an exception error-handling page to log the error information to an 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 Rerference: #error.HTTPReferer#
Diagnositcs: #error.diagnostics#">
</body>
</html>
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:
"Error","web-13","12/19/01","11:29:07",MYAPP,"Exception error --
Exception type: coldfusion.runtime.CfErrorWrapper
Template: /MYStuff/NeoDocs/exceptiontest.cfm,
Remote Address: 127.0.0.1,
HTTP Rerference:
Diagnositcs: 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:
cflog type attribute
cfapplication tag, normally in the Application.cfm filecflog text attribute.