Dynamic debug templates in ColdFusion?

This post is more than 2 years old.

Robby asked:

I had read your post about


and was already trying to customize another debugging template when a question came to mind.

Do you know if the debugging template can be specified in application.cfm? In other words:

if (some condition)
use main debugging template
use alternate debugging template

I have server admin access currently and debugging is on for my IP and I can easily switch. As long as the developer had his IP listed and if he could change the template in code, it could be customized per developer. That way if I were changing something, it wouldn't affect all the other developers or depending on the page content, we might want to debug differently.

I was really happy Robby asked this question. ColdFusion debug templates are something I've played with in the past but not recently. How many of my readers are aware that the debugging information you see is actually built from a ColdFusion file? You can edit this to your liking or even build new ones. I've blogged on this a few times before (see the link above), and it's 1/2 of what makes ColdFire awesome. Now certainly this is not something the casual developer will need to mess with, but there are certainly times when there could be a valid reason to poke your head in and tinker a bit.

That being said - unfortunately - you can't dynamically change the debug template. (Ok, technically you can via the Admin API, but that's going to be server wide and not something you want to toggle with every request.) However, you could easily build a debug template that simply acts as a router. So you could imagine your Application.cfc setting a request variable (request.debugformat="fatstyle") that is then picked up by the template. Depending on the value another CFM is included to handle the display. Simple - and there's nothing wrong with that.

Is anyone out there mucking with their debug templates? I'd love to hear it if so.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Jeff Caldwell posted on 5/1/2011 at 9:31 AM

I've been monkeying quite a bit lately with debug templates as I've been playing around with Chrome extensions and trying to come up with something like ColdFire for Chrome. I find myself using Firefox less and less these days, but sorely missed having the ColdFire capabilities in my browser. It's been an interesting exercise and, while there is still some black magic in there that I don't fully understand, working through what you guys had done with ColdFire helped a lot. Unfortunately, Chrome is still missing a few key pieces to be able to do everything that was there in ColdFire (like ability to get/set http headers) but it should be coming in the next Chrome dev release. Anyway, I plan to do more experimenting as Chrome matures a bit and see if I can't work some additional pieces in like viewing server logs. I definitely recommend that anybody spending a lot of time doing CF development customize the debug templates to suit their specific use case. There's nothing scary there.

Comment 2 by Raymond Camden posted on 5/1/2011 at 5:26 PM

Jeff, you will be happy to know that Google is adding support for extensions to their dev tools. ColdFire for Google will _definitely_ be possible soon.