File: Zend_Log-Writers-Syslog.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (65 lines) | stat: -rw-r--r-- 2,504 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect2 id="zend.log.writers.syslog">
    <title>Writing to the System Log</title>

    <para>
        <classname>Zend_Log_Writer_Syslog</classname> writes log entries to the
        system log (syslog). Internally, it proxies to <acronym>PHP</acronym>'s
        <methodname>openlog()</methodname>,
        <methodname>closelog()</methodname>, and
        <methodname>syslog()</methodname> functions.
    </para>

    <para>
        One useful case for <classname>Zend_Log_Writer_Syslog</classname>
        is for aggregating logs from clustered machines via the system log
        functionality. Many systems allow remote logging of system events, which
        allows system administrators to monitor a cluster of machines from a
        single log file.
    </para>

    <para>
        By default, all syslog messages generated are prefixed with the string
        "Zend_Log". You may specify a different "application" name by which to
        identify such log messages by either passing the application name to the
        constructor or the application accessor:
    </para>

    <programlisting language="php"><![CDATA[
// At instantiation, pass the "application" key in the options:
$writer = new Zend_Log_Writer_Syslog(array('application' => 'FooBar'));

// Any other time:
$writer->setApplicationName('BarBaz');
]]></programlisting>

    <para>
        The system log also allows you to identify the "facility," or
        application type, logging the message; many system loggers will actually
        generate different log files per facility, which again aids
        administrators monitoring server activity.
    </para>

    <para>
        You may specify the log facility either in the constructor or via an
        accessor. It should be one of the <methodname>openlog()</methodname>
        constants defined on the <ulink url="http://php.net/openlog">openlog()
            manual page</ulink>.
    </para>

    <programlisting language="php"><![CDATA[
// At instantiation, pass the "facility" key in the options:
$writer = new Zend_Log_Writer_Syslog(array('facility' => LOG_AUTH));

// Any other time:
$writer->setFacility(LOG_USER);
]]></programlisting>

    <para>
        When logging, you may continue to use the default
        <classname>Zend_Log</classname> priority constants; internally, they are
        mapped to the appropriate <methodname>syslog()</methodname> priority
        constants.
    </para>
</sect2>