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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/network.xml, last change in rev 1.2 -->
<refentry id="function.openlog">
<refnamediv>
<refname>openlog</refname>
<refpurpose>Open connection to system logger</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>openlog</methodname>
<methodparam><type>string</type><parameter>ident</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
<methodparam><type>int</type><parameter>facility</parameter></methodparam>
</methodsynopsis>
<para>
<function>openlog</function> opens a connection to the system
logger for a program. The string <parameter>ident</parameter> is
added to each message. Values for <parameter>option</parameter>
and <parameter>facility</parameter> are given below.
The <parameter>option</parameter> argument is used to indicate
what logging options will be used when generating a log message.
The <parameter>facility</parameter> argument is used to specify what
type of program is logging the message. This allows you to specify
(in your machine's syslog configuration) how messages coming from
different facilities will be handled.
The use of <function>openlog</function> is optional. It
will automatically be called by <function>syslog</function> if
necessary, in which case <parameter>ident</parameter> will default
to &false;.
</para>
<para>
<table>
<title><function>openlog</function> Options</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>LOG_CONS</entry>
<entry>
if there is an error while sending data to the system logger,
write directly to the system console
</entry>
</row>
<row>
<entry>LOG_NDELAY</entry>
<entry>
open the connection to the logger immediately
</entry>
</row>
<row>
<entry>LOG_ODELAY</entry>
<entry>
(default) delay opening the connection until the first
message is logged
</entry>
</row>
<row>
<entry>LOG_PERROR</entry>
<entry>print log message also to standard error</entry>
</row>
<row>
<entry>LOG_PID</entry>
<entry>include PID with each message</entry>
</row>
</tbody>
</tgroup>
</table>
You can use one or more of this options. When using multiple options
you need to <literal>OR</literal> them, i.e. to open the connection
immediately, write to the console and include the PID in each message,
you will use: <literal>LOG_CONS | LOG_NDELAY | LOG_PID</literal>
</para>
<para>
<table>
<title><function>openlog</function> Facilities</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>LOG_AUTH</entry>
<entry>
security/authorization messages (use LOG_AUTHPRIV instead
in systems where that constant is defined)
</entry>
</row>
<row>
<entry>LOG_AUTHPRIV</entry>
<entry>security/authorization messages (private)</entry>
</row>
<row>
<entry>LOG_CRON</entry>
<entry>clock daemon (cron and at)</entry>
</row>
<row>
<entry>LOG_DAEMON</entry>
<entry>other system daemons</entry>
</row>
<row>
<entry>LOG_KERN</entry>
<entry>kernel messages</entry>
</row>
<row>
<entry>LOG_LOCAL0 ... LOG_LOCAL7</entry>
<entry>reserved for local use, these are not available in Windows</entry>
</row>
<row>
<entry>LOG_LPR</entry>
<entry>line printer subsystem</entry>
</row>
<row>
<entry>LOG_MAIL</entry>
<entry>mail subsystem</entry>
</row>
<row>
<entry>LOG_NEWS</entry>
<entry>USENET news subsystem</entry>
</row>
<row>
<entry>LOG_SYSLOG</entry>
<entry>messages generated internally by syslogd</entry>
</row>
<row>
<entry>LOG_USER</entry>
<entry>generic user-level messages</entry>
</row>
<row>
<entry>LOG_UUCP</entry>
<entry>UUCP subsystem</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<para>
<literal>LOG_USER</literal> is the only valid log type under Windows
operating systems
</para>
</note>
<para>
See also <function>define_syslog_variables</function>,
<function>syslog</function> and
<function>closelog</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|