fielding 97/10/05 22:22:01
Modified: src/main http_log.h http_log.c
Log:
If HAVE_SYSLOG, fix the APLOG_* symbols to use the syslog.h definitions
and the syslog-dependent mask for the priority level. Allow APLOG_NOTICE
to bypass the priority level when not logging to syslog.
Revision Changes Path
1.17 +26 -2 apachen/src/main/http_log.h
Index: http_log.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_log.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- http_log.h 1997/10/06 03:50:24 1.16
+++ http_log.h 1997/10/06 05:21:59 1.17
@@ -50,6 +50,22 @@
*
*/
+#ifdef HAVE_SYSLOG
+#include <syslog.h>
+
+#define APLOG_EMERG LOG_EMERG /* system is unusable */
+#define APLOG_ALERT LOG_ALERT /* action must be taken immediately */
+#define APLOG_CRIT LOG_CRIT /* critical conditions */
+#define APLOG_ERR LOG_ERR /* error conditions */
+#define APLOG_WARNING LOG_WARNING /* warning conditions */
+#define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */
+#define APLOG_INFO LOG_INFO /* informational */
+#define APLOG_DEBUG LOG_DEBUG /* debug-level messages */
+
+#define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */
+
+#else
+
#define APLOG_EMERG 0 /* system is unusable */
#define APLOG_ALERT 1 /* action must be taken immediately */
#define APLOG_CRIT 2 /* critical conditions */
@@ -58,9 +74,17 @@
#define APLOG_NOTICE 5 /* normal but significant condition */
#define APLOG_INFO 6 /* informational */
#define APLOG_DEBUG 7 /* debug-level messages */
+
+#define APLOG_LEVELMASK 7 /* mask off the level value */
+
+#endif
+
+#define APLOG_NOERRNO (APLOG_LEVELMASK + 1)
+
+#ifndef DEFAULT_LOGLEVEL
#define DEFAULT_LOGLEVEL APLOG_ERR
-#define APLOG_LEVELMASK 15 /* mask off the level value */
-#define APLOG_NOERRNO 16
+#endif
+
#define APLOG_MARK __FILE__,__LINE__
typedef struct _trans {
1.39 +18 -7 apachen/src/main/http_log.c
Index: http_log.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- http_log.c 1997/10/06 03:50:24 1.38
+++ http_log.c 1997/10/06 05:21:59 1.39
@@ -69,7 +69,6 @@
#ifdef HAVE_SYSLOG
-#include <syslog.h>
static TRANS facilities[] = {
{"auth", LOG_AUTH},
@@ -284,14 +283,26 @@
int save_errno = errno;
FILE *logf;
- if (s && (level & APLOG_LEVELMASK) > s->loglevel)
- return;
-
- if (!s) {
+ if (s == NULL) {
logf = stderr;
- } else if (s && s->error_log) {
+ }
+ else if (s->error_log) {
+ /*
+ * If we are doing normal logging, don't log messages that are
+ * above the server log level unless it is a startup/shutdown notice
+ */
+ if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
+ ((level & APLOG_LEVELMASK) > s->loglevel))
+ return;
logf = s->error_log;
- } else {
+ }
+ else {
+ /*
+ * If we are doing syslog logging, don't log messages that are
+ * above the server log level (including a startup/shutdown notice)
+ */
+ if ((level & APLOG_LEVELMASK) > s->loglevel)
+ return;
logf = NULL;
}