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]Configure::write(‘debug’,0);[/php]
Here is the complete code on how they handle ajax calls:
[php]// Hack to prevent wierd output with AJAX
if ($this->RequestHandler->isAjax()) {
$db =& ConnectionManager::getDataSource(‘default’);
$db->fullDebug = false;
}[/php]
2 Comments
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.




ace john macaro on July 27th, 2008
in 1.2beta
just do it in controller method.
Configure::write(‘debug’,2);