Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you keep debug code out of production?

It happens to the best of us.

alt text

Particularly when dealing with languages without built in debugging capabilities such as breakpoints and watched variables, these bugs bite developers. Debugging code, alerts and Response.Writes, show up in production code.

How do you separate debugging concerns from functional code in javascript, php, or vbscript? How do you ensure those debugging changes never enter production environments?

like image 754
Thomas Langston Avatar asked Dec 09 '10 15:12

Thomas Langston


People also ask

What is leftover debug code?

When this sort of debug code is left in the application, the application is open to unintended modes of interaction. These back door entry points create security risks because they are not considered during design or testing and fall outside of the expected operating conditions of the application.


2 Answers

The most simple method

define("DEBUG", true);   if (DEBUG) {     echo "Debug Method"; } 

For js its similar.

like image 119
KingCrunch Avatar answered Oct 10 '22 07:10

KingCrunch


Human error is hard to prevent

https://meta.stackexchange.com/questions/71780/lol-debugging-are-we-so-homepage-alerts-false

like image 36
ajreal Avatar answered Oct 10 '22 07:10

ajreal