PhpRiot
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

Creating a Log

To get started logging, instantiate a Writer and then pass it to a Log instance:

<?php
$logger 
= new Zend_Log();
$writer = new Zend_Log_Writer_Stream('php://output');

$logger->addWriter($writer);

It is important to note that the Log must have at least one Writer. You can add any number of Writers using the Log's addWriter() method.

Alternatively, you can pass a Writer directly to constructor of Log as a shortcut:

<?php
$writer 
= new Zend_Log_Writer_Stream('php://output');
$logger = new Zend_Log($writer);

The Log is now ready to use.

Zend Framework