php-doc-en/reference/network/functions/openlog.xml
Daniel Egeberg 96c9d88bad Converted to utf-8
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
2010-03-28 22:10:10 +00:00

219 lines
6.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openlog" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>openlog</refname>
<refpurpose>Open connection to system logger</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<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.
</para>
<para>
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>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>ident</parameter></term>
<listitem>
<para>
The string <parameter>ident</parameter> is added to each message.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
The <parameter>option</parameter> argument is used to indicate
what logging options will be used when generating a log message.
<table>
<title><function>openlog</function> Options</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>LOG_CONS</constant></entry>
<entry>
if there is an error while sending data to the system logger,
write directly to the system console
</entry>
</row>
<row>
<entry><constant>LOG_NDELAY</constant></entry>
<entry>
open the connection to the logger immediately
</entry>
</row>
<row>
<entry><constant>LOG_ODELAY</constant></entry>
<entry>
(default) delay opening the connection until the first
message is logged
</entry>
</row>
<row>
<entry><constant>LOG_PERROR</constant></entry>
<entry>print log message also to standard error</entry>
</row>
<row>
<entry><constant>LOG_PID</constant></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>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>facility</parameter></term>
<listitem>
<para>
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.
<table>
<title><function>openlog</function> Facilities</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>LOG_AUTH</constant></entry>
<entry>
security/authorization messages (use
<constant>LOG_AUTHPRIV</constant> instead
in systems where that constant is defined)
</entry>
</row>
<row>
<entry><constant>LOG_AUTHPRIV</constant></entry>
<entry>security/authorization messages (private)</entry>
</row>
<row>
<entry><constant>LOG_CRON</constant></entry>
<entry>clock daemon (cron and at)</entry>
</row>
<row>
<entry><constant>LOG_DAEMON</constant></entry>
<entry>other system daemons</entry>
</row>
<row>
<entry><constant>LOG_KERN</constant></entry>
<entry>kernel messages</entry>
</row>
<row>
<entry><constant>LOG_LOCAL0</constant> ... <constant>LOG_LOCAL7</constant></entry>
<entry>reserved for local use, these are not available in Windows</entry>
</row>
<row>
<entry><constant>LOG_LPR</constant></entry>
<entry>line printer subsystem</entry>
</row>
<row>
<entry><constant>LOG_MAIL</constant></entry>
<entry>mail subsystem</entry>
</row>
<row>
<entry><constant>LOG_NEWS</constant></entry>
<entry>USENET news subsystem</entry>
</row>
<row>
<entry><constant>LOG_SYSLOG</constant></entry>
<entry>messages generated internally by syslogd</entry>
</row>
<row>
<entry><constant>LOG_USER</constant></entry>
<entry>generic user-level messages</entry>
</row>
<row>
<entry><constant>LOG_UUCP</constant></entry>
<entry>UUCP subsystem</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<para>
<constant>LOG_USER</constant> is the only valid log type under Windows
operating systems
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>syslog</function></member>
<member><function>closelog</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->