Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Debug Output and Error Handling in CF5 and CFMX November 12, 2002 By Douglas M. Smith Application Architect for Teratech, Inc.

Similar presentations


Presentation on theme: "Dynamic Debug Output and Error Handling in CF5 and CFMX November 12, 2002 By Douglas M. Smith Application Architect for Teratech, Inc."— Presentation transcript:

1 Dynamic Debug Output and Error Handling in CF5 and CFMX November 12, 2002 By Douglas M. Smith Application Architect for Teratech, Inc.

2 Reasons for this Presentation  I wanted to see the web site exactly as the client would see it, yet at the same time, I wanted developer’s to see debug and error output.  I wanted to allow developers to view debug and error info, but hide it from regular users.  I wanted to embed custom debug output in my code during development, and keep it available for later testing and bug fixing, without having to comment code in and out.  I wanted a mechanism to turn dynamically turn on/off the standard CF debug output display (at the bottom of each page)  For security reasons, I only wanted the developer to be able to see or turn on error or debug output.

3 Code in Application.cfm  Sets variables that are used in and error handling templates  Sets variables that are used to control access to debug output. Basically, these are lists of IP addresses, similar to how the CF Admin controls access to debug output.  Has code to set CLIENT.DEBUG variable, which is the main switch variable.  Sets the template.

4 Code in OnRequestEnd.cfm  Code to turn on/off standard CF debug output  Code to turn on/off custom debug output  In CF5, use MOD_DISPLAY_VARIABLES.cfm  In CFMX, don’t need this. Can use settings in CFADMIN, or just use CFDUMP

5 Code in Template Usage:  Code to email any error to web master  Code to turn off email, and display error, if desired by developer  In CFMX, code to display error context

6 Custom Debug Output Code Put code like this this wherever you want custom debug output: Your custom debug output.

7 Code in Template Usage:  Very similar to CFERROR  Code to email any error to web master  Code to turn off email, and display error, if desired by developer  In CFMX, code to display error context

8 “Gotchas”  Code in Application.cfm before the statement is not caught by anything, so make sure it is bug-free.  Error handlers must be tested and be error free before they will work. This is especially important in CFMX.  If there is an error in the error_handler, you won’t get your email. Generate an error using to make sure you are getting your error emails.

9 More “Gotchas”  Compilation errors in normal code are not caught by CFERROR handler. These are displayed to standard error output. Only runtime errors are caught.  Compilation errors in CFERROR handler itself under CFMX are not reported at all! It simply appears like the tag does not work. You will get default debug output to the screen, and you will loose error handling benefits.

10 New Features in CFMX  is awesome!  TagContext is now available in as well as in CFCATCH  Standard debug output has actual line numbers, and error in bold. Cool, but feature is lost when using error or cfcatch variables!

11 Questions?

12 Contact Info Douglas M. Smith Douglas@teratech.com Download this presentation from: http://www.cfug-md.org/


Download ppt "Dynamic Debug Output and Error Handling in CF5 and CFMX November 12, 2002 By Douglas M. Smith Application Architect for Teratech, Inc."

Similar presentations


Ads by Google