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.
Managing Log FilesYou 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:
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." |