httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victor J. Orlikowski" <>
Subject Config files, main loop, and logging
Date Wed, 11 Apr 2001 20:24:08 GMT
Hi all,

Running into a problem, in the debugging of one of my favorite things,
mod_so. While doing some debugging, I had set LogLevel in my conf file
to debug, but got no messages about loading DSOs. So I dug a little
Basically, in the main loop we do an ap_read_config(), which does an
init_server_config(). This, among other things, sets the server
loglevel to DEFAULT_LOGLEVEL, which is equivalent to APLOG_WARN.
Afterwards, we do ap_build_config(), which works on the directives for
mod_so and other modules. 
Now, if a DSO is loaded successfully, mod_so tries to log this at the
APLOG_DEBUG level. It does so by calling ap_log_perror(), though it
really should do it by calling ap_log_error(). No matter. Under the
covers, those two both call log_error_core(). Now, the server loglevel
has not been changed from DEFAULT_LOGLEVEL, and so, the following
checks cause the debug messages from mod_so (and any other modules
that do debug logging as the initialize from directive) to never

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_and_mask != APLOG_NOTICE) &&
        (level_and_mask > DEFAULT_LOGLEVEL))
    logf = stderr_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_and_mask != APLOG_NOTICE) && 
         (level_and_mask > s->loglevel))
     logf = s->error_log;

We see that, using ap_log_perror() (which sets s to NULL), any
messages that are logged at a lesser severity than APLOG_WARN are
discarded. With ap_log_error(), the server loglevel determines the
severity of message permitted - unfortunately, this isn't set to the
value specified in the conf file until ap_process_config_tree() is
called, 2 lines after ap_read_config() in main(). Hence, any debug
messages from modules like mod_so are discarded.

In my opinion, the correct way to fix this is to have the server
fields filled in, prior to acting upon module config options.
However, I'd like to kill two birds with one stone, and get rid of the
config re-read that occurs in main(). Which leads me to ask what
brought the necessity to load the config file a second time (i.e. why
is there a need to wait for the log files to "settle").

Congrats if you got this far,

Victor J. Orlikowski

View raw message