note 3813 modified in function.syslog by irchtml

From: Date: Tue, 24 Feb 2004 09:07:20 +0000
Subject: note 3813 modified in function.syslog by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65641@lists.php.net to get a copy of this message
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): #define LOG_INFO 6 /* informational */ #define LOG_MAIL (2<<3) /* mail system */ 2<<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. --was-- [I hope the HTML comes out right...] For the-header-file-enabled: <p> man 3 syslog defines the priorities, but not the integer values. For that you'll need to read your system header file. <p> 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. http://www.php.net/manual/en/function.syslog.php

« previous php.notes (#65641) next »