PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




syslog

Name

syslog — Sends a message to the system logger.

Synopsis

bool syslog(priority, message);
integer priority: Integer flag to contain the facility and level of the log message
string message: Message to log

Returns

TRUE

Description

The syslog() function sends messages 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.

The priority argument is a combination of the level and facility of the message. The message level indicates the severity of the log message; the facility 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 various levels and facilities.

The priority argument is an integer value, but PHP provides a set of named constants to make the task of setting it easier. To combine the level constants with the facility constants, use the bitwise or (|) operator (for example, LOG_ERROR|LOG_AUTH_PRIV). The following tables list the levels and facilities.

Level Description
LOG_EMERG The system is (or will soon be) unusable. Cross your fingers, get out your backups, and prepare for a long night. On Windows systems, this is represented as a message of the error type in the event log.
LOG_ALERT Something bad has happened. You should fix it before something else goes wrong. On Windows systems, this is represented as a message of the warning type in the event log.
LOG_CRIT A critical error has occurred. On Windows systems, this is represented as a message of the warning type in the event log.
LOG_ERR A normal error has occurred. On Windows systems, this is represented as a message of the warning type in the event log.
LOG_WARNING Something that looks a bit like an error has occurred. On Windows systems, this is represented as a message of the warning type in the event log.
LOG_NOTICE Something normal but undesirable or significant has happened. On Windows systems, this is represented as a message of the warning type in the event log.
LOG_INFO Log an informational message.On Windows systems, this is represented as a message of the information type in the event log.
LOG_DEBUG Log a message to help with debugging. On Windows systems, this is represented as a message of the warning type in the event log.


Facility Description
LOG_AUTH Security and authorization messages (deprecated on most systems - use LOG_AUTHPRIV instead)
LOG_AUTHPRIV Private security and authorization messages
LOG_CRON Cron daemon
LOG_DAEMON Miscellaneous system daemons
LOG_KERN Kernel messages
LOG_LOCAL0 to LOG_LOCAL7 Reserved for local use
LOG_LPR Printer spool
LOG_MAIL Mail subsystem
LOG_NEWS News subsystem
LOG_SYSLOG Reserved for messages generated internally by syslogd
LOG_USER Miscellaneous user-level messages
LOG_UUCP UUCP subsystem


Note

LOG_USER is the only valid log type under Windows operating systems.

Caution

The message argument should not contain sequences such as %s that are recognized by the printf() function. Literal percent symbols (%) can be included in the log message by using two percent symbols in a row (%%).



Version

PHP Version: 3+, 4+

Example

Example 1319. Send an informational message to the authentication log

syslog(LOG_INFO | LOG_AUTH_PRIV, "$PHP_AUTH_USER logged onto $SCRIPT_NAME");



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.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.