example of syslog and man pages pointers

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@31927 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jesus M. Castagnetto 2000-09-04 07:19:20 +00:00
parent 5965008df0
commit 4fbe9e0635

View file

@ -881,8 +881,37 @@ if(!$fp) {
</table>
</para>
<para>
More information on the syslog facilities can be found in the man
pages for syslog on Unix machines.
<example>
<title>Using <function>syslog</function></title>
<programlisting role="php">
&lt;?php
define_syslog_variables();
// open syslog, include the process ID and also send
// the log to standard error, and use a user defined
// logging mechanism
openlog(&quot;myScripLog&quot;, LOG_PID | LOG_PERROR, LOG_LOCAL0);
// some code
if (authorized_client()) {
// do something
} else {
// unauthorized client!
// log the attempt
$access = date(&quot;Y/m/d H:i:s&quot;);
syslog(LOG_WARNING,&quot;Unauthorized client: $access $REMOTE_ADDR ($HTTP_USER_AGENT)&quot;);
}
closelog();
?&gt;
</programlisting>
</example>
For information on setting up a user defined log handler, see the
<citerefentry><refentrytitle>syslog.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> Unix manual page. More
information on the syslog facilities and option can be found in the man
pages for <citerefentry><refentrytitle>syslog</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> on Unix machines.
</para>
<para>
On Windows NT, the syslog service is emulated using the Event