Using Log Files


Log files let a developer audit events. If an exception occurs, it is written to the ColdFusion log file when the error is returned to the user. Along with the error itself, other information is stored in the log file, such as the user's browser type and originating IP address.

In addition to ColdFusion error logs, other types of log files are available to the developer. The log files are named and described in Table 25.2.

Table 25.2. ColdFusion Log Files

LOG FILE NAME

DESCRIPTION

application.log

Logs problems reported to the user, including all run-time errors

car.log

Logs problems with site archive and restore operations

customtag.log

Logs problems with custom tags

exceptions.log

Logs stack traces occurring in the server

executive.lo

Logs problems with the ColdFusion service, including unexpected service restarts

mail.log

Logs problems with an SMTP mail server

mailsent.log

Logs messages sent by ColdFusion

scheduler.log

Logs scheduled events and problems with them

server.log

Logs slow-running pages; similar to webserver.log but with less intelligible diagnostic information than is intended for the Macromedia technical support team


Managing Log Files

You can manage log files from the Log Files screen in ColdFusion Administrator. Active logs are listed in the Available Log Files table and can be managed directly through the Web-based interface controls in the following ways:

  • Log entries can be searched and viewed in report, concise, or raw formats, in descending order. The Filter tool provides options to restrict the report by date range, entry type, and keywords.

  • The entire log can be downloaded for offline processing.

  • Logs can be archived or stored. Archived logs are simply renamed and saved to the log directory as logname.nnn, where nnn starts at 001.

  • Active logs can be deleted from the server.

The Logging Settings screen is used to specify the log file directory, set the maximum log file size, and configure other logging options.

<cflog>

ColdFusion lets developers generate their own log information. <cflog> can be used to record entries in the existing set of ColdFusion logs or in completely new logs that have the same format as the existing ones.

For example, a syndication service might be scheduled to retrieve information from a remote site and store it within the local application. scheduler.log records the success or failure of the ColdFusion template's execution, but it doesn't record any detail about what actually occurred during syndication. If there were a run-time error, you would have to crawl through application.log looking for an answer. <cflog> could be used to create a special syndication.log file to record information about the agent's activity.

 <!--- retrieve wddx news data from moreover ---> <cftry>   <cfhttp url="http://p.moreover.com/                cgilocal/page?c=Australia%20news&o=wddx"           method="GET"           resolveurl="false"           timeout="1"           throwonerror="Yes">   </cfhttp>   <cfcatch type="COM.ALLAIRE.COLDFUSION.HTTPFAILURE">     <cfdump var="#cfcatch#">     <cflog text="Agent unable to connect to server."            file="syndication"            type="Warning">     <cfabort>   </cfcatch>   <cfcatch type="COM.ALLAIRE.COLDFUSION.HTTPCONNECTIONTIMEOUT">     <cflog text="Agent timed out connecting to server."            file="syndication"            type="Warning">     <cfabort>   </cfcatch>   <cfcatch type="Any">     <cflog text="Agent failed - unknown error."            file="syndication"            type="Warning">     <cfabort>   </cfcatch> </cftry> <!--- agent successful ---> <cflog text="Agent shaken but not stirred."        file="syndication"> 

HTTP agents are discussed in Chapter 43, "Other Internet Protocols."




Macromedia ColdFusion MX 7 Certified Developer Study Guide
Macromedia ColdFusion MX 7 Certified Developer Study Guide
ISBN: 0321330110
EAN: 2147483647
Year: 2004
Pages: 389
Authors: Ben Forta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net