openlogDescriptionopenlog() opens a connection to the system logger. On UNIX-like systems, this is generally syslogd (run man syslogd for more information). On the Windows family of operating systems, this is the event log. Not all flavors of the Windows operating systems have the event log facility - see your system's help files and manual for more information. Use of this function is optional. PHP automatically opens a connection to the system logger when syslog() is called. The advantage of using openlog() is that the developer gains extra control over how messages are logged. Developers can choose a string to have prefixed to every entry written to the log using PHP's syslog() with the ident argument. Usually ident is used to identify the program that's logging the messages. The behavior of the logging can be modified using the options and facility arguments. Both of these arguments are integer values; however, PHP provides named constants to make the task of setting them easier. The following table lists the options that can be set. Note that more than one option can be set. Use the bitwise or (|) operator to join separate option constants into a single integer value (for example, LOG_CONS | LOG_NDELAY | LOG_PID).
NoteLOG_PID is the only valid option under Windows operating systems. The facility argument tells the system logger what kind of program is logging a message. The system logger then decides what to do with the message based on how it's configured to handle the facility passed. The following table lists the types that can be set.
NoteLOG_USER is the only valid log type under Windows operating systems.
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|