Something you might want to consider is that, if you are emailing
errors to yourself via cfdump, those dumps could contain info that you
might be a little leery of sending free/clear over a non-secure email.
 Not just things like form variables of a form post blows up (which
could expose yucky things like unencrypted credit card numbers).

One solution to that is to store the errors on disk and then notify
yourself of the occurrence of the error -- but not its specifics --
via email.  Then you go to your top secret -- and secured -- error
handling area, log in and see the errors (or log in via terminal
server and view them thataway).

The code below does the dumping thing pretty thoroughly.  It could be
written more sparingly but I just snipped it out of something a lot
bigger.  It will loop thru a large list of potential scopes and dump
them all out to a single variable via cfcontent.  You can then plug
that variable value into an email, or a cffile statement as you
please.  Dumping the variables scope like this also means that any
queries you run get dumped as well and, while this can be very helpful
it can also be a mighty big file... not something you might want to
email for size reasons.

Typical size of one of these in email is 80-350k, but the sky is the
limit.  Still I prefer the verbose logging as too much info is usually
better than the reverse.

I wrote up the whole procedure start to finish at
http://mysecretbase.com/Building_A_ColdFusion_Error_Handler.cfm and am
currently writing something a little more streamlined for release as a
custom tag that can be used either site wide or app-wide.

<cfscript>
// -----------------------
// ERROR HANDLER VARIABLES
// -----------------------
variables.ErrorHandler=StructNew();
// the list of scopes to loop thru.
variables.ErrorHandler.vars="CFCATCH,ERROR,APPLICATION,ATTRIBUTES,CALLER,CGI,CLIENT,FORM,REQUEST,SESSION,THIS,THISTAG,URL,VARIABLES";
</cfscript>
<cfsavecontent variable="variables.ErrorHandler.errorDump">
<!--- 
Loop over all of the variable scopes listed above 
--->
<cfloop 
        list="#variables.ErrorHandler.vars#" 
        index="loopItem">
        <!--- 
        Has the scope been defined? 
        --->
        <cfif IsDefined("#loopItem#")>
                <!--- 
                it has been defined.  Dump out its contents for inspection
                --->
                <cfdump 
                        var="#Evaluate(loopItem)#" 
                        label="#loopItem#">             
        </cfif> 
</cfloop>
</cfsavecontent>
-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212047
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to