1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect2 id="zend.log.writers.syslog">
4 <title>Writing to the System Log</title>
7 <classname>Zend_Log_Writer_Syslog</classname> writes log entries to the
8 system log (syslog). Internally, it proxies to PHP's
9 <functionname>openlog()</functionname>,
10 <functionname>closelog()</functionname>, and
11 <functionname>syslog()</functionname> functions.
15 One useful case for <classname>Zend_Log_Writer_Syslog</classname>
16 is for aggregating logs from clustered machines via the system log
17 functionality. Many systems allow remote logging of system events, which
18 allows system adminstrators to monitor a cluster of machines from a
23 By default, all syslog messages generated are prefixed with the string
24 "Zend_Log". You may specify a different "application" name by which to
25 identify such log messages by either passing the application name to the
26 contructor or the application accessor:
29 <programlisting role="php"><![CDATA[
30 // At instantiation, pass the "application" key in the options:
31 $writer = new Zend_Log_Writer_Syslog(array('application' => 'FooBar'));
34 $writer->setApplication('BarBaz');
38 The system log also allows you to identify the "facility," or
39 application type, logging the message; many system loggers will actually
40 generate different log files per facility, which again aids
41 administrators monitoring server activity.
45 You may specify the log facility either in the constructor or via an
46 accessor. It should be one of the <functionname>openlog()</functionname>
47 constants defined on the <ulink url="http://php.net/openlog">openlog()
51 <programlisting role="php"><![CDATA[
52 // At instantiation, pass the "facility" key in the options:
53 $writer = new Zend_Log_Writer_Syslog(array('facility' => LOG_AUTH));
56 $writer->setFacility(LOG_USER);
60 When logging, you may continue to use the default
61 <classname>Zend_Log</classname> priority constants; internally, they are
62 mapped to the appropriate <functionname>syslog()</functionname> priority