A suggestion has been made by a team member to leave all debug code intact in our web pages... and then to create a variable that can be turned on / off to enable / disable debugging.

This is a technique we use in some of our low level, non web code. Just wondering if anyone had any comments on how they've implemented something similar for web applications? Some of our web applications are written in lua, and others in PHP.

I like the idea and I've seen it used in different types of solutions. However, my knee-jerk reaction is that for web apps, it might not be such a great idea. I don't want to have a tonn of logs generated on the web server. At the same time, it'd be nice to simply enable a variable and then start collecting information.

The alternative could be to always have a test page that calls the same methods that the production page does, but the test page dumps a bunch of data to the screen.

Just wondering if anyone has any experience / comments on doing this for the web as far as how to build it in, how difficult it is to maintain etc. Thanks.

1 Answer 1


We use such kind of debug versions or debug switches in all of our applications, be it desktop, server or web frontend, and over the years had good experiences with it.

Of course the amount of additional info varies between the environments. "Debug active" does not necessarily mean that you generate tons of huge log files. In fact, it has been turned out being more useful to have a different configuration switch for log verbosity.

The debug version typically contains all kind of internal consistency checks, some additional warnings and assertions, and also some additional information shown right in the UI. We integrate those information and checks that we find useful during development, test and even deployment, on the other hand we also do not hesitate to get rid of things that are not (or no longer) needed.

Key is, that the goal of a debug version is to actively support development and bug fixing, while a release version is intended to run fast and with a small footprint.

  • can you give me an example of what your logic might look like in the case of a web application? pseudocode is really all I'm after.
    – dot
    Commented Feb 10, 2014 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.