Example
Open and close connection of system logger:
html
<?php
function _log($text) {
openlog("phperrors", LOG_PID | LOG_PERROR);
syslog(LOG_ERR, $text);
closelog();
....
....
}
?>
Definition and Usage
The openlog() function opens the connection of system logger.
Syntax
text
openlog(ident, option, facility)
Parameter Values
| 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 |
| 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 |
Technical Details
| Return Value: | TRUE on success, FALSE on failure |
|---|---|
| PHP Version: | 4.0+ |