1

Where i need to place my "myScriptLog" Log File and what are the confogurations to Log the PHP Application

Below is the Sample Syslog Code

openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);                            

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 {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
}
closelog();
4

2 回答 2

0

这可能会帮助你

http://www.phpclasses.org/browse/file/12157.html

使用上面的类来记录系统错误

于 2013-08-12T10:05:59.643 回答
0

也许使用error_loghttp://de3.php.net/manual/en/function.error-log.php

然后你可以指定目的地:

bool error_log ( string $message [, int $message_type = 0 [, string $destination [, string $extra_headers ]]] )

编辑:或者您可以使用系统日志:http ://www.php.net/manual/en/function.syslog.php然后您的日志将只是转到系统日志而不是myScriptLog(取决于您需要什么)。

这有帮助吗?

于 2013-08-12T08:19:35.300 回答