目录

PHP openlog() 函数

❮ PHP 网络参考

示例

打开和关闭系统记录器的连接:

<?php
function _log($text) {
openlog("phperrors", LOG_PID | LOG_PERROR);
syslog(LOG_ERR, $text);
closelog();
....
....
}
?>


定义和用法

openlog() 函数打开系统记录器的连接。

语法

openlog( ident, option, facility)

参数值

Parameter Description
ident Required. Specifies a string ident that is added to each message
option Required. Specifies what logging options will be used when generating a log message. Can be one or more of the following options (separated with |):
  • LOG_CONS
  • LOG_NDELAY
  • LOG_ODELAY
  • LOG_PERROR
  • LOG_PID
facility Required. Specifies what type of program is logging the message:
  • LOG_AUTH
  • LOG_AUTHPRIV
  • LOG_CRON
  • LOG_DAEMON
  • LOG_KERN
  • LOG_LOCAL0...LOG_LOCAL7
  • LOG_LPR
  • LOG_MAIL
  • LOG_NEWS
  • LOG_SYSLOG
  • LOG_USER - (is the only valid log type for Windows OS)
  • LOG_UUCP


技术细节

返回值: TRUE 成功,FALSE 失败
PHP 版本: 4.0+

❮ PHP 网络参考