Often times when I am writing ajax or model-glue apps, something will go wrong and its difficult to see the values that are complaining. Sure, you could pass things forward to the view, catch/try, maybe set your controller to allow output and dump it from there, but this little custom tag seems to do the trick most of the time for me.
<cfset dumpMe = attributes.var />
<cfsavecontent variable=<span class='cc_value'>"debug"</span>>
<cfdump var=<span class='cc_value'>"#dumpMe#"</span>>
</cfsavecontent>
<cffile action=<span class='cc_value'>"write"</span> file=<span class='cc_value'>"#attributes.file#"</span> output=<span class='cc_value'>"#debug#"</span>>
its called 'fileDump.cfm' in my custom tags folder, and you use it just like you would think:
<cf_filedump var=<span class='cc_value'>"#varToDump#"</span> file=<span class='cc_value'>"c:\debug.html"</span> />
Now I will get a nice file I can open up regardless of the final rendered output of my page / event, and see what the heck is going on. You can dump the entire event, or the 'this' or 'variables' scope as well, and get the whole ball of wax in a nice file that you can dig through at your leisure!








#1 by larry c. lyons - July 25, 2008 at 2:47 PM
<cfset request.cfdumpinited = false />
it will ensure that the formatting is correct.
#2 by [Justice] - July 27, 2008 at 6:39 PM