In your applicaiton.cfc, you can do something like the following: <cffunction name="OnError" access="public" output="true"> <cfargument name="Exception" type="any" required="true" /> <cfargument name="EventName" type="string" required="false" default="" /> <cftry> <!--- log error ---> <cffile action="APPEND" file="/log.txt" output="OnError : #Now()# - [#ARGUMENTS.Exception.Message# - #ARGUMENTS.Exception.Type#] #ARGUMENTS.Exception.Detail# #cgi.PATH_INFO# " addnewline="true"/> <!--- dump the error and save it for output ---> <cfsavecontent variable="exc"> #now()# <cfdump var="#ARGUMENTS.Exception#"> </cfsavecontent> <cffile action="write" output="#exc#" nameconflict="overwrite" file="/error.html"/> <cfif cgi.REMOTE_ADDR eq "::1"> <!--- if the error is internal, show the message ---> <cfinclude template="/error.html"> <cfelse> <!--- otherwise show a nice message ---> <cfinclude template="/error.cfm"> <cfset application.email.sendmail(error,exc)> </cfif> <cfcatch> <cfset onApplicationStart()> </cfcatch> </cftry> </cffunction>
This will log the error, display it internally or send an email (using a scope collection email object). In your email you can include items that may help you in determining the error. In the error.cfm, I suggest that you output HTML only as any coldfusion could cause an infinite loop. I am doing absolute paths in this example but generally I store error stuff in a folder outside of the root. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330144 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4