The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

Customized Debugging

posted under category: ColdFusion on September 9, 2004 at 1:00 am by Nathan

One thing I think more developers should know is the ease of changing the debugging info in CFMX. Obviously you can flip a few switches in your CF Administrator under the debugging settings, but did you know you can actually edit the debugging files and create your own?

My favorite trick is to dump the queries. Rarely do we ever select data, then display it all, just as it came out of the database. Instead we use it here and there in the page, or display pieces of it. But what does your data actually look like when it comes out of your DB? Let's make a customized debug script and solve this problem.

Navigate yourself to your debug folder, usually %cfdir%\wwwroot\WEB-INF\debug\, and make a copy of the classic.cfm file. Call it dump.cfm.

Open that file up, and find the section on SQL Queries. You see it loops over the cfdebug_queries query object. Right before the </cfloop> tag, add this bit of code:

<cfif isQuery(cfdebug_queries.result[cfdebug_queries.currentRow])>
<cfdump var="#cfdebug_queries.result[cfdebug_queries.currentRow]#">

Now save the file, log into your CF Admin and change your "Debugging Output Format" file to this new dump file. The next page you load will give you insight into every query on your page.