★ wanayoo — archive 1999 http://php.net/manual/it/function.syslog.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Network
Quick Reference
Network
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this page
* checkdnsrr
* closelog
* debugger_off
* debugger_on
* fsockopen
* gethostbyaddr
* gethostbyname
* gethostbynamel
* getmxrr
* getprotobyname
* getprotobynumber
* getservbyname
* getservbyport
* openlog
* pfsockopen
* socket_set_blocking
* syslog

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: syslog
View the source code for this pageSearch the site



Previous page
 socket_set_blocking
 Updated
Mon, 18 Sep 2000
ODBC 
Next page


syslog

(PHP3 <= 3.0.16, PHP4 )

syslog -- Generate a system log message

Description

int syslog (int priority, string message)

Syslog() generates a log message that will be distributed by the system logger. priority is a combination of the facility and the level, values for which are given in the next section. The remaining argument is the message to send, except that the two characters %m will be replaced by the error message string (strerror) corresponding to the present value of errno.

More information on the syslog facilities can be found in the man pages for syslog on Unix machines.

On Windows NT, the syslog service is emulated using the Event Log.


User Contributed Notes: syslog


bb@lb-data.co.at
08-Sep-1999 03:54
In Windows NT, use the following values of priority:
1 = error,
6 = info



fwo@obsidian.co.za
09-Dec-1999 09:59
The text was taken directly out of a unix man page. On a unix system do man 3 syslog and you wil get the info


rcgraves+php@brandeis.edu
17-Feb-2000 12:51
[I hope the HTML comes out right...]
For the-header-file-enabled:


man 3 syslog defines the priorities, but not the integer values. For that you'll need to read your system header file.


Let's suppose I want to log an informational message in the mail log (which happens to be true). The man page tells me I want LOG_MAIL|LOG_INFO. So I look in /usr/include/sys/syslog.h and find (this happens to be Linux, your system could be different):
<pre>
#define LOG_INFO 6 /* informational */
#define LOG_MAIL (2&lt;&lt;3) /* mail system */
</pre>
2&lt;&lt;3 means shift 3 bits left, which means multiply by 8. So I want 2*8 + 6 = 22. syslog(22,"this message will appear in the mail log"); And indeed it does.



fmajid@kefta.com
29-Apr-2000 02:43
Using PHP3, the documentation does not match the actual implementation.
To generate a syslog, I found the following code will work:


<PRE>
syslog("local7.info", "syslog message")
</PRE>
when the manual says the first argument should be an integer.



 About Notes


Previous page
 socket_set_blocking
 Updated
Mon, 18 Sep 2000
ODBC 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.