Dynamic debug templates in ColdFusion?

Robby asked:

I had read your post about

http://www.coldfusionjedi.com/index.cfm/2006/7/3/Debug-template-information-in-the-order-of-process

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
else
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 developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

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

Comments