This article is a continuation of Log Your PHP Application With Zend_Log (Part 1). Check it out if you missed it. Last time I wrote about some features of Zend_Log. And now I will explain about installation and terminologies on Zend_Log.
Installation
If you use Zend_Log separately from Zend Framework, so make Zend directory in PHP include path or on your working directory, and put Log.php and Log folder into it.
Important Terminologies On Zend_Log
Here is list of terminologies on Zend_Log.
Logger is object from Zend_Log. This object will be often used in application. Logger must contain at least one writer to write out log message.
Writer is object that will be used to save log message to storage (file, database, memory or PHP Output Buffer).
Formatter is object that will be used to format log data before written by a writer. To change format from log message, formatter must be defined first and then sent to writer object.
Filter is object that will be used to filter log message before written by a writer. To filter log message on all writer, just sent filter on log object. And to filter log message on current writer, sent it to current writer.
On Zend_Log, priorities are sorted from the most important priority:
- EMERG (0)
- ALERT (1)
- CRIT (2)
- ERR (3)
- WARN (4)
- NOTICE (5)
- INFO (6)
- DEBUG (7)
These priorities are standard from BSD syslog protocol. Zend_Log allow you to define your own priority too. You can do it with addPriority() method.
Zend_Log has default events (timestamp, priorty, priorityName and message). Everytime we call log() method from logger object, these events will be sent to writer to written to storage. We can add our own event with call setEventItem() method.
Now, we have know what is Zend_Log, it's installation, and some terminologies on it. The next article I will explain about Zend_Log usage.