You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by kb...@apache.org on 2015/04/08 09:33:39 UTC
svn commit: r1672014 - in /httpd/httpd/trunk: CHANGES server/config.c
Author: kbrand
Date: Wed Apr 8 07:33:39 2015
New Revision: 1672014
URL: http://svn.apache.org/r1672014
Log:
UNSET the VirtualHost's LogLevel just before calling ap_merge_log_config(),
to make sure that the DEFAULT_LOGLEVEL (APLOG_WARNING) is also in effect
when ap_process_config_tree() in main.c:main() walks through the
VirtualHost sections.
See https://mail-archives.apache.org/mod_mbox/httpd-dev/201404.mbox/%3C535CC85B.80501%40velox.ch%3E
for one case this is addressing. This reverts the change from r1024427 on
the one hand, but still ensures correct LogLevel merging on the other hand.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/server/config.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1672014&r1=1672013&r2=1672014&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Apr 8 07:33:39 2015
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) core: Make sure to also print VirtualHost log messages of level
+ "warn" or higher at configuration parsing time. [Kaspar Brand]
+
*) mod_logio: Add LogIOTrackTTFB and %^FB logformat to log the time
taken to start writing response headers. [Eric Covener]
Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1672014&r1=1672013&r2=1672014&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Wed Apr 8 07:33:39 2015
@@ -2194,7 +2194,7 @@ AP_CORE_DECLARE(const char *) ap_init_vi
s->keep_alive = -1;
s->keep_alive_max = -1;
s->error_log = main_server->error_log;
- s->log.level = APLOG_UNSET;
+ s->log.level = main_server->log.level;
s->log.module_levels = NULL;
/* useful default, otherwise we get a port of 0 on redirects */
s->port = main_server->port;
@@ -2286,6 +2286,7 @@ AP_DECLARE(void) ap_fixup_virtual_hosts(
if (virt->keep_alive_max == -1)
virt->keep_alive_max = main_server->keep_alive_max;
+ virt->log.level = APLOG_UNSET;
ap_merge_log_config(&main_server->log, &virt->log);
dconf = ap_get_core_module_config(virt->lookup_defaults);
Re: svn commit: r1672014 - in /httpd/httpd/trunk: CHANGES
server/config.c
Posted by Kaspar Brand <ht...@apache.org>.
On 14.8.15 20:01, Eric Covener wrote:
> On Wed, Apr 15, 2015 at 12:02 PM, Kaspar Brand <ht...@velox.ch> wrote:
>> The other option to fix the problem which originally triggered this
>> investigation would be to simply replace "cmd->server" in
>> ssl_engine_config.c:836 with "NULL", though it would only fix this
>> particular case, and not help with other places with the same underlying
>> problem.
>
> What are the different scenarios that are bad in 2.4? I stumbled on
> this thread on a search about a related topic.
>
> I think this is the immediate one, but I really don't like the idea of
> using the default loglevel there:
>
> LogLevel crit
> <virtualhost *:443>
> SSLSomethingThatWouldWarn
> LogLevel warn
> </virtualhost>
>
> What are the other variants?
That's basically the pattern I meant. With "other places with the same
underlying problem", I was referring to other modules which use
cmd->server for logging during ap_process_config_tree walking (and
before ap_fixup_virtual_hosts is called).
There are a number of "ap_log_error(..., cmd->server, ...)" occurrences
in mod_env, mod_ldap, mod_proxy, mod_authnz_ldap, mod_auth_digest,
mod_file_cache, mod_rewrite, and mod_alias, and in particular when they
are using APLOG_WARNING, these messages are not logged unless there's a
preceding LogLevel statement in the respective VirtualHost block.
server/core.c on the other hand also has a few places where this problem
occurs, here's an example:
LogLevel warn
<VirtualHost *:80>
ServerName example.net
DefaultType text/plain
</VirtualHost>
The "Ignoring deprecated use of DefaultType..." message is only output
if an additional "LogLevel warn" statement in the VirtualHost block is
inserted (which must appear before the DefaultType statement).
Kaspar
Re: svn commit: r1672014 - in /httpd/httpd/trunk: CHANGES server/config.c
Posted by Eric Covener <co...@gmail.com>.
On Wed, Apr 15, 2015 at 12:02 PM, Kaspar Brand <ht...@velox.ch> wrote:
> The other option to fix the problem which originally triggered this
> investigation would be to simply replace "cmd->server" in
> ssl_engine_config.c:836 with "NULL", though it would only fix this
> particular case, and not help with other places with the same underlying
> problem.
What are the different scenarios that are bad in 2.4? I stumbled on
this thread on a search about a related topic.
I think this is the immediate one, but I really don't like the idea of
using the default loglevel there:
LogLevel crit
<virtualhost *:443>
SSLSomethingThatWouldWarn
LogLevel warn
</virtualhost>
What are the other variants?
I know prior to 2.4, the following scenario was broken:
LogLevel crit
<virtualhost *:443>
SSLSomethingThatWouldWarn
</virtualhost>
...
LogLevel warn
--
Eric Covener
covener@gmail.com
Re: svn commit: r1672014 - in /httpd/httpd/trunk: CHANGES server/config.c
Posted by Kaspar Brand <ht...@velox.ch>.
On 14.04.2015 06:54, Kaspar Brand wrote:
> On 13.04.2015 22:05, Ruediger Pluem wrote:
>> Shouldn't we only do that in case that vit->log.level is set to main_server->log.level?
>> Don't we lose the configuration done by the user for this particular host otherwise?
>
> Yes, you're right - thanks for the review. It also noticed this in the
> meantime, and when I tried to come up with a fix, more special cases
> were turning up (whether main_server->log.level is still at
> DEFAULT_LOGLEVEL might also have to be taken into account).
>
> Hopefully I'll find time for more closely examining this tomorrow.
> Otherwise I will revert r1672014, as it is clearly not a complete
> solution yet.
Reverted r1672014. After more digging, I think there's no practical way
to base the decision whether to reset on the current value of
virt->log.level when reaching ap_fixup_virtual_hosts - too many
conceivable combinations of global LogLevel vs. per-vhost LogLevel (and
the order they appear in the config). Extending the ap_logconf struct
seems unavoidable if the approach with adjustments in
ap_init_virtual_host/ap_fixup_virtual_hosts is the right one.
Another idea would be to apply the default log level in log_error_core()
when we encounter APLOG_UNSET, as illustrated by the attached patch.
Maybe doing this check in each log_error_core() invocation adds too much
overhead, given that it's actually just addressing an issue which occurs
at startup/reload?
The other option to fix the problem which originally triggered this
investigation would be to simply replace "cmd->server" in
ssl_engine_config.c:836 with "NULL", though it would only fix this
particular case, and not help with other places with the same underlying
problem.
Kaspar
Re: svn commit: r1672014 - in /httpd/httpd/trunk: CHANGES server/config.c
Posted by Kaspar Brand <ht...@velox.ch>.
On 13.04.2015 22:05, Ruediger Pluem wrote:
> On 04/08/2015 09:33 AM, kbrand@apache.org wrote:
>> Modified: httpd/httpd/trunk/server/config.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1672014&r1=1672013&r2=1672014&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/server/config.c (original)
>> +++ httpd/httpd/trunk/server/config.c Wed Apr 8 07:33:39 2015
>> @@ -2194,7 +2194,7 @@ AP_CORE_DECLARE(const char *) ap_init_vi
>> s->keep_alive = -1;
>> s->keep_alive_max = -1;
>> s->error_log = main_server->error_log;
>> - s->log.level = APLOG_UNSET;
>> + s->log.level = main_server->log.level;
>> s->log.module_levels = NULL;
>> /* useful default, otherwise we get a port of 0 on redirects */
>> s->port = main_server->port;
>> @@ -2286,6 +2286,7 @@ AP_DECLARE(void) ap_fixup_virtual_hosts(
>> if (virt->keep_alive_max == -1)
>> virt->keep_alive_max = main_server->keep_alive_max;
>>
>> + virt->log.level = APLOG_UNSET;
>
> Shouldn't we only do that in case that vit->log.level is set to main_server->log.level?
> Don't we lose the configuration done by the user for this particular host otherwise?
Yes, you're right - thanks for the review. It also noticed this in the
meantime, and when I tried to come up with a fix, more special cases
were turning up (whether main_server->log.level is still at
DEFAULT_LOGLEVEL might also have to be taken into account).
Hopefully I'll find time for more closely examining this tomorrow.
Otherwise I will revert r1672014, as it is clearly not a complete
solution yet.
Kaspar
Re: svn commit: r1672014 - in /httpd/httpd/trunk: CHANGES
server/config.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 04/08/2015 09:33 AM, kbrand@apache.org wrote:
> Author: kbrand
> Date: Wed Apr 8 07:33:39 2015
> New Revision: 1672014
>
> URL: http://svn.apache.org/r1672014
> Log:
> UNSET the VirtualHost's LogLevel just before calling ap_merge_log_config(),
> to make sure that the DEFAULT_LOGLEVEL (APLOG_WARNING) is also in effect
> when ap_process_config_tree() in main.c:main() walks through the
> VirtualHost sections.
>
> See https://mail-archives.apache.org/mod_mbox/httpd-dev/201404.mbox/%3C535CC85B.80501%40velox.ch%3E
> for one case this is addressing. This reverts the change from r1024427 on
> the one hand, but still ensures correct LogLevel merging on the other hand.
>
> Modified:
> httpd/httpd/trunk/CHANGES
> httpd/httpd/trunk/server/config.c
>
> Modified: httpd/httpd/trunk/CHANGES
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1672014&r1=1672013&r2=1672014&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
> +++ httpd/httpd/trunk/CHANGES [utf-8] Wed Apr 8 07:33:39 2015
> @@ -1,6 +1,9 @@
> -*- coding: utf-8 -*-
> Changes with Apache 2.5.0
>
> + *) core: Make sure to also print VirtualHost log messages of level
> + "warn" or higher at configuration parsing time. [Kaspar Brand]
> +
> *) mod_logio: Add LogIOTrackTTFB and %^FB logformat to log the time
> taken to start writing response headers. [Eric Covener]
>
>
> Modified: httpd/httpd/trunk/server/config.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1672014&r1=1672013&r2=1672014&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/config.c (original)
> +++ httpd/httpd/trunk/server/config.c Wed Apr 8 07:33:39 2015
> @@ -2194,7 +2194,7 @@ AP_CORE_DECLARE(const char *) ap_init_vi
> s->keep_alive = -1;
> s->keep_alive_max = -1;
> s->error_log = main_server->error_log;
> - s->log.level = APLOG_UNSET;
> + s->log.level = main_server->log.level;
> s->log.module_levels = NULL;
> /* useful default, otherwise we get a port of 0 on redirects */
> s->port = main_server->port;
> @@ -2286,6 +2286,7 @@ AP_DECLARE(void) ap_fixup_virtual_hosts(
> if (virt->keep_alive_max == -1)
> virt->keep_alive_max = main_server->keep_alive_max;
>
> + virt->log.level = APLOG_UNSET;
Shouldn't we only do that in case that vit->log.level is set to main_server->log.level?
Don't we lose the configuration done by the user for this particular host otherwise?
> ap_merge_log_config(&main_server
->log, &virt->log);
>
> dconf = ap_get_core_module_config(virt->lookup_defaults);
>
>
>
Regards
RĂ¼diger