Zend Framework 1 – trace and log sql errors and exceptions
Posted on: August 12, 2013 /
Categories: Zend
Zend Framework 1 – trace sql errors and exceptions and put them in a log file.
Add the next code in the ErrorController.php:
<?php
class ErrorController extends Zend_Controller_Action
{
...
public function errorAction()
{
...
if (get_class($errors->exception) == 'Zend_Db_Statement_Exception') {
$writer = new Zend_Log_Writer_Stream("ADD HERE YOUR LOG PATH");
$logger = new Zend_Log($writer);
$logger->info($errors->exception);
}
...
}
...
}