From 4fbe9e063561f33ed09a861b3c872d71983a8e9a Mon Sep 17 00:00:00 2001 From: "Jesus M. Castagnetto" Date: Mon, 4 Sep 2000 07:19:20 +0000 Subject: [PATCH] example of syslog and man pages pointers git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@31927 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/network.xml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/functions/network.xml b/functions/network.xml index 3a98017f2f..1e678961d8 100644 --- a/functions/network.xml +++ b/functions/network.xml @@ -881,8 +881,37 @@ if(!$fp) { - More information on the syslog facilities can be found in the man - pages for syslog on Unix machines. + + Using <function>syslog</function> + +<?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(); +?> + + + For information on setting up a user defined log handler, see the + syslog.conf + 5 Unix manual page. More + information on the syslog facilities and option can be found in the man + pages for syslog + 5 on Unix machines. On Windows NT, the syslog service is emulated using the Event