How to change your DEBUG level on the fly

The debugging features of cakePhp is very very helpful to me specially the full debug with sql. Sometimes it's a bit irritating if your dealing with ajax calls. In looking at the cheesecake source code, I found this hack to change it to 0, 1, 2 or 3 on the fly:

PHP:
  1. Configure::write('debug',0);

Here is the complete code on how they handle ajax calls:

PHP:
  1. // Hack to prevent wierd output with AJAX
  2. if ($this->RequestHandler->isAjax()) {
  3. $db =& ConnectionManager::getDataSource('default');
  4. $db->fullDebug = false;
  5.  
  6. }

2 Comments

ace john macaro  on July 27th, 2008

in 1.2beta
just do it in controller method.

Configure::write(’debug’,2);

phpcurious  on August 4th, 2008

@ace john macaro,

you can do that also in cakephp 1.1. I put that line in a controller if I want to debug a particular controller.

Leave a Comment