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

Simple Formatting

Zend_Log_Formatter_Simple is the default formatter. It is configured automatically when you specify no formatter. The default configuration is equivalent to the following:

'%timestamp% %priorityName% (%priority%): %message%' PHP_EOL;
$formatter = new Zend_Log_Formatter_Simple($format);

A formatter is set on an individual Writer object using the Writer's setFormatter() method:

= new Zend_Log_Writer_Stream('php://output');
$formatter = new Zend_Log_Formatter_Simple('hello %message%' PHP_EOL);

$logger = new Zend_Log();


// outputs "hello there"

The constructor of Zend_Log_Formatter_Simple accepts a single parameter: the format string. This string contains keys surrounded by percent signs (e.g. %message%). The format string may contain any key from the event data array. You can retrieve the default keys by using the DEFAULT_FORMAT constant from Zend_Log_Formatter_Simple.

Zend Framework