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

Logging Messages

To log a message, call the log() method of a Log instance and pass it the message with a corresponding priority:

<?php
$logger
->log('Informational message'Zend_Log::INFO);

The first parameter of the log() method is a string message and the second parameter is an integer priority. The priority must be one of the priorities recognized by the Log instance. This is explained in the next section.

A shortcut is also available. Instead of calling the log() method, you can call a method by the same name as the priority:

<?php
$logger
->log('Informational message'Zend_Log::INFO);
$logger->info('Informational message');

$logger->log('Emergency message'Zend_Log::EMERG);
$logger->emerg('Emergency message');

Zend Framework