Are <cfdump/>'s blowing up your Inbox? Need something better?

Update: Download fixed

Here is a little intro to our (Lance Smith and myself) proposed presentations on error handling for CFUnited and MVCFUG....
Most developers know the importance of having error handling on their site. But, many do not know how extensible error handling can be and the control they have over it with the power and ease of ColdFusion.

Macromedia and now Adobe has been kind enough to provide us these error handling files. ColdFusion uses these files to output the errors to the browser. These files are:
        {CFRoot\wwwroot}\WEB-INF\exception\detail.cfm
        {CFRoot\wwwroot}\WEB-INF\debug\classic.cfm
        {CFRoot\wwwroot}\WEB-INF\exception\exception_en.xml
        {CFRoot\wwwroot}\WEB-INF\exception\gettemplate.cfm
        {CFRoot\wwwroot}\WEB-INF\exception\errorcontext.cfm
My question goes out to all ColdFusion programers, why do we use <CFDump/> or other solutions in our error handling emails? Yes, <CFDump/> provides a lot of information, but have you looked at the size of those emails? All that extra HTML and CSS really adds up quickly. In my case, I am on a corporate Exchange server that only allows for a certain maximum size of my Exchange folders. And when you implement this <CFDump/> mindset into a legacy application that has never had error handling before, what do you get? You get a over capactiy Inbox in a couple days. Or in my case the first time I tried this, I had an over capacity Inbox in under 4 hours. (No wonder the ColdFusion server was unstable.)

So my solution to this problem was to use ColdFusion's classic.cfm and combine it with all of the other default ColdFusion error handling pages into a single template that can easily be copied from application to application or server to server. This template provides all of the error handling output that ColdFusion displays to browser but is ouput to an email. Here is an example of what it outputs:

At the top of the file, I have provide a way to customize the behavior of the error handling code.

Change the Name of the Application.


    <cfparam name="application.applicationFriendlyTitle" default="My CF Application">

Users who receive this email.

    <cfparam name="application.emailErrorUsers" default="">

Who is this email from?

    <cfparam name="application.emailErrorFrom" default="">

DevUser=0. The template will email the error and display a nice user friendly error message to the enduser. DevUser=1 will output it to the screen.

    <cfparam name="session.devUser" default="0">

This code is used to display a nice user friendly error message to the enduser.

    <cfsavecontent variable="errorHtml">
        <cfoutput>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
                <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                    <title>#application.applicationFriendlyTitle#</title>
                    <link href="/css/somestylesheet.css" rel="stylesheet" type="text/css" media="screen" /><!--- You will probably want to use a style sheet --->
                </head>
                <body>
                    <p class="explanation">
                        We apologize for any inconvenience, an email has been sent to #application.applicationFriendlyTitle# Support. <br />
                        Please click your browser's Back button and retry your request.
                    </p>
                </body>
            </html>    
        </cfoutput>
    </cfsavecontent>

Comments
Aaron Wolfe's Gravatar Oops. I am working on getting the download to work.
-Aaron
# Posted By Aaron Wolfe | 12/3/08 5:01 PM
Aaron Wolfe's Gravatar The download now works. ColdFusion was trying to run the page instead of downloading it. LOL
# Posted By Aaron Wolfe | 12/3/08 5:04 PM
Oscar Arevalo's Gravatar Aaron, I also had the same problem a while ago (but imagine getting errors from 30 servers on a ***really high traffic *** environment). However my solution to this was to keep the cfdumps but not send the bug reports via email, but instead to a central server and database. It worked really neat for centrally managing bug reports across multiple applications and clusters. The end result: http://bugloghq.riaforge.org/

Check it out, maybe you can combine both approaches...

Oscar
# Posted By Oscar Arevalo | 12/3/08 5:31 PM
Kawq's Gravatar Where else apart from e.x. http://rapidpedia.com/ and http://rapid4me.com/ can I find and download these applications for free? Thanks
# Posted By Kawq | 2/9/09 5:03 AM
Aaron Wolfe's Gravatar You can also download other applications from http://www.riaforge.org . Also take a look at Ray Camden's blog at http://www.coldfusionjedi.com
# Posted By Aaron Wolfe | 2/11/09 12:23 PM
rapidshare search's Gravatar thank you for this article
# Posted By rapidshare search | 2/17/09 1:20 PM
# Posted By gucci bags | 5/21/10 12:17 PM