Bug 60964 - EXEC_ON_READ directives can't log at levels above DEFAULT_LOGLEVEL
Summary: EXEC_ON_READ directives can't log at levels above DEFAULT_LOGLEVEL
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2017-04-07 19:11 UTC by Jacob Champion
Modified: 2017-04-19 16:04 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Champion 2017-04-07 19:11:35 UTC
Filing a placeholder so I don't forget about this...

If a directive is running as EXEC_ON_READ, any attempts to log at a level above DEFAULT_LOGLEVEL will silently fail, even if the LogLevel is tuned at the appropriate level for that module. There are two unrelated effects that cause this:

1) If we're not logging against a server_rec (or the server_rec is NULL), the core logging code refuses to log anything above ap_default_loglevel, unless it's a NOTICE or the server has been compiled with -DDEBUG.

2) If we are logging against a server_rec, the LogLevel directive will still not have been parsed by the time EXEC_ON_READ directives are being run. So DEFAULT_LOGLEVEL will be the highest level possible.

This seems to affect only LoadModule and LoadFile, which try to log what files they're loading at DEBUG level. It would have affected mod_remoteip's RemoteIPTrustedProxyList and RemoteIPInternalProxyList, if ap_pcfg_openfile's debug logging weren't already wrapped in an #ifdef DEBUG.
Comment 1 Jacob Champion 2017-04-19 16:04:51 UTC
Note that the default loglevel can be explicitly set with -e. It's just surprising that changing a directive to EXEC_ON_READ forces it to use a different LogLevel from the rest of the server.