<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.6 $ --> <!-- 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>int</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 -->