printf() debugging is the practice of inserting ad-hoc calls to printf() (or an equivalent) in an effort to see the code path and/or the changes in variable state. printf() debugging isn’t pretty but even when sophisticated logging and diagnostics are available it can still have a place as a useful technique.
I’ve seen debugging techniques for web applications where diagnostic information is cached and then displayed by writing it out as formatted HTML at the end of the page or setting it as the value of a textarea element or something similar.
But there’s a simpler, less obtrusive way.
Instead of building or borrowing the plumbing to cache the diagnostics and messing up the appearance of the page with stuff that doesn’t belong, generate inline HTML comments.
Sure. It’s an extra step to choose ‘View Source’ to see the comments. But it’s not really an inconvenience. And there’s no harm in leaving in comments that don’t contain sensitive information. They might just prove to be invaluable when used to support in-the-field troubleshooting.