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:

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:

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.

We apologize for the inconvenience. </p>



<cflog file="myapp_errors"

    text="Exception error -- 

      Exception type: #error.type#

      Template: #error.template#,

      Remote Address: #error.remoteAddress#, 

      HTTP Rerference: #error.HTTPReferer#

      Diagnositcs: #error.diagnostics#"

    type="Error">



</body>

</html>

Reviewing the code

The following table describes the highlighted code and its function:
Code
Description

<cflog   file="myapp_errors" 

  text="Exception error 

   Exception type: #error.type# 

   Template: #Error.Template#, 

   Remote Address: #Error.RemoteAddress#,

   Diagnositcs: #Error.Diagnostics#" 

  type="Error"> 

When this page is processed, log an error message to the file myapp_errors.log file in the ColdFusion log directory containing the thread ID, date and time, application, and 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.



Banner.Novgorod.Ru