Tag : zend-framework-1

Zend Framework 1 – trace and log sql errors and exceptions

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);
}
...
}
...
}