httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject [PATCH] Fix stderr logging
Date Fri, 17 Apr 1998 09:24:53 GMT

As recently mentioned when using the DSO mechanism to load modules
via mod_so, the ap_log_error() debug messages from mod_so are _ALWAYS_
printed to stderr on server startup like this:

[debug] mod_so.c(258): loaded module config_log_module
[debug] mod_so.c(258): loaded module mime_module
[debug] mod_so.c(258): loaded module negotiation_module
[debug] mod_so.c(258): loaded module autoindex_module
[debug] mod_so.c(258): loaded module dir_module
[debug] mod_so.c(258): loaded module userdir_module
[debug] mod_so.c(258): loaded module access_module
[debug] mod_so.c(258): loaded module setenvif_module
[debug] mod_so.c(258): loaded module config_log_module
[debug] mod_so.c(258): loaded module mime_module
[debug] mod_so.c(258): loaded module negotiation_module
[debug] mod_so.c(258): loaded module autoindex_module
[debug] mod_so.c(258): loaded module dir_module
[debug] mod_so.c(258): loaded module userdir_module
[debug] mod_so.c(258): loaded module access_module
[debug] mod_so.c(258): loaded module setenvif_module

I wondered why there is no way to disable this. Even a "LogLevel emerg"
_before_ the LoadModule lines didn't work. Why? Because when stderr-logging is
still active there is no check for the loglevel at all. The appended patch
fixes this by making sure that even when no s->loglevel is available at this
stage the DEFAULT_LOGLEVEL is used. This is what is intuitively expected IMHO.
And this way we get rid of the confusing messages above when DSO-based module
are used.

Comments?
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: main/http_log.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/http_log.c,v
retrieving revision 1.52
diff -u -r1.52 http_log.c
--- http_log.c	1998/04/11 18:51:34	1.52
+++ http_log.c	1998/04/17 09:15:10
@@ -284,6 +284,14 @@
     FILE *logf;
 
     if (s == NULL) {
+	/*
+	 * If we are doing stderr logging (startup), don't log messages that are
+	 * above the default server log level unless it is a startup/shutdown
+	 * notice
+	 */
+	if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
+	    ((level & APLOG_LEVELMASK) > DEFAULT_LOGLEVEL))
+	    return;
 	logf = stderr;
     }
     else if (s->error_log) {

Mime
View raw message