Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Filtering for a Writer Instance

To filter only on a specific Writer instance, use the addFilter() method of that Writer:

= new Zend_Log();

$writer1 = new Zend_Log_Writer_Stream('/path/to/first/logfile');

$writer2 = new Zend_Log_Writer_Stream('/path/to/second/logfile');

// add a filter only to writer2
$filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT);

// logged to writer1, blocked from writer2
$logger->info('Informational message');

// logged by both writers
$logger->emerg('Emergency message');

Zend Framework