I set my loggers up in my Bootstrap.php like so:
$logger = new Zend_Log();
if($environment->debug == '1')
{
$stream = @fopen('/var/www/html/rta/rta.log','a',false);
if(!$stream){ throw new Exception('Failed to open log stream'); }
$writer = new Zend_Log_Writer_Stream($stream);
$logger->addWriter($writer);
$logger->addWriter(new Zend_Log_Writer_Firebug());
}
else
{
// Do something else
}
Zend_Registry::set('logger',$logger);
I have the following code that I set up to fail:
$data = array(
'config_id' => $config->getConfigId(),
'pass_column' => $config->getPassColumn(),
'filename' => $config->getFilename(),
'date_format' => $config->getDateFormat(),
'mapping_config' => $config->getMappingConfig(),
'config_name' => $config->getConfigName(),
'client_id' => $config->getClientId(),
'description' => $config->getDescription(),
);
$where = $this->getDbTable()->getAdapter()->quoteInto('config_id = ?',$config->getConfigId());
$where = null;
try
{
$this->getDbTable()->update($data,$where);
}catch(Exception $e)
{
Zend_Registry::get('logger')->err('Could not update configuration.');
Zend_Registry::get('logger')->err($e);
return false;
}
return true;
I set two log writers: Stream and FirePHP.
The stream log writer successfully caught and wrote the exception but FirePHP didn't do anything. If I put other log messages other places in my code, like indexAction
it shows those just fine in both. Am I missing something?
EDIT The failure code is in my database mapper, not a controller. Could it be that it doesn't have access to the HTTP headers?
The following example below shows how to make FirePHP get the header info it needs without using the FrontController.