PHP openlog() Function

❮ PHP Network Reference

Example

Open and close connection of system logger:

<?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

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 |):
  • 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


Technical Details

Return Value: TRUE on success, FALSE on failure
PHP Version: 4.0+

❮ PHP Network Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.