mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
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:
parent
5965008df0
commit
4fbe9e0635
1 changed files with 31 additions and 2 deletions
|
@ -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">
|
||||
<?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("myScripLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// some code
|
||||
|
||||
if (authorized_client()) {
|
||||
// do something
|
||||
} else {
|
||||
// unauthorized client!
|
||||
// log the attempt
|
||||
$access = date("Y/m/d H:i:s");
|
||||
syslog(LOG_WARNING,"Unauthorized client: $access $REMOTE_ADDR ($HTTP_USER_AGENT)");
|
||||
}
|
||||
|
||||
closelog();
|
||||
?>
|
||||
</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
|
||||
|
|
Loading…
Reference in a new issue