On a private listserv (the first rule of fight club is...) Charlie Arehart brought up some interesting ideas he had in regards to the default debugging template in ColdFusion. One of these actually happened to match perfect something that was included in the latest ColdFire release, specifically a way to see what percent of time was spent doing database queries. (ColdFire will also tell you what percent of the total execution time was spent in CFC methods.) On a whim I decided to quickly add the following. Credit goes to Charlie for the ideas.
- You can now see a total query time:
If the execution time of a query is over 1k, I added lsNumberFormat to the display. This will change 3448ms to 3,448ms. Charlie thought this might be a bit easier to read. The comma right after ms makes it a bit confusing to me though. I tested this by adding a large number to my query since I was unable to write a slow query. (I've got mad SQL skills.)
If the execution time of a query is too slow, flag it like the template list does. If you look in the screen shot above you will see a few red lines. I had set my 'highlight templates' setting in the CF Admin to 2 ms, which is very low of course, but it helps show the issue. If your query takes too long, it is now highlighted.
It uses the same threshold as the templates do.
I've attached the template to this blog entry. Since this is replacing a 'core' CF tag, you will want to back your copy up first. I tested this in CF8, but I'm sure it would work in CF7 and probably 6 as well. If it doesn't work, um, too bad.
Also note that I do not want to put words into Charlie's mouth. What I wrote was based on my impression of what he wanted. I'm sure he will chime in if I misunderstood him.
If you're going to that much trouble can you go ahead and add in the queryparam substitution so the paramaters show up inline with the query? Yep - I know that is already in coldfire.
or parameters even...zoid power activate!
I have always wanted to modify the tempalte so that queries that use <cfqueryparam> will actaully have the params listed in the query rather than (param 1), (param 2) , etc...
Ray, one thing I noticed while doing this. There seems to be a difference between classic.cfm on CF 7 and CF 8.
There are 4 lines like this:
if( cfdebug_templates.recordCount eq 1 and len(trim(cfdebug_templates.et)) )
if( cfdebug_templates.recordCount eq 1 and not len(trim(cfdebug_templates.et)) )
Your file obviously uses the CF 8 way, which makes more sense I think.
Probably so. I just assumed it didn't change cuz it certainly looks like it hasn't for years. :)
@Scott S - some friends of mine already did that, plus a few other things ;-)
I still have to do most of my testing in IE, so ColdFire isn't always an option... so any ideas like the ones on your post are nice
I wonder - would it makes sense to start a new project named something like "ImprovedClassic." Something that takes these updates and rolls them into one? Not to compete w/ ColdFire, I'd rather use ColdFire, but as Aaron says, some folks can't use it because of IE.
That's awesome, Ray. Thanks for the effort. My goal in posting on that "other list" was indeed to get this into the version of the debugging output offered by CF out of the box, but in the meantime this is a great way to provide the benefits for many.
I totally agree with your last comment about creating a new project for improved debugging. I'd really recommend something other than "improvedclassic", though. Folks who never bother to tweak (or even alter the admin settings) for the debugging output won't connect the dots that the basic debugging output is provided by this template called classic.cfm. How about something like "ImprovedDebugOutput"? Not sexy, but the point is that it may catch attention where a sexy codename might not. Just a thought.
And yes, we'd want to ensure it works on 6, 7, and 8 (and might be nice to have versions that work on Railo and BD, too.)
All this strikes me as a kind of project that could bring a lot more developers into an open source project, since it's pretty straightforward stuff and that most could use.
Ray, if you're reluctant to take on yet another project, or want a co-pilot, I'd be very interested.
Heh, yes, 'improvedclassic' is a horrible name. My brain is officially powered down for today. :)
I don't think either Railo or BD support debugging via a CFML template. Wait - no, BD doesn't, but Railo might. Whatever - if it _could_ be made to work in either then it is probably worth the effort.
And yes - I have enough projects. I don't think you actually 'own' any project at RIAForge, do you? This may be a perfect opportunity for you to start.
Sure, Ray. That would be cool. I've long wanted to contribute, and this is a great starting point for me.
So, before I create it, we need a name. I just noticed that RIAForge projects can have spaces in their name, so how about a codename that's an acronym (and the project name, with both, could be):
MIDO - Much Improved Debugging Output (Mido is a watch name, too, but few may recognize the pun)
FIDO - ? Improved Debugging Output (a better pun, about fido fetching. Just need a good f-word--not that one! One might propose "far" but if Adobe later improves the built-in, then it would be lame. "Fan" connotes community-contributed, but seems a little lame.)
LIDO - ? Improved Debugging Output
Any others? Even not following the IDO pattern? :-)
How about a recursive acronym?
FIDO - FIDO Improved Debugging Output
I like MIDO.