On Tue, Mar 14, 2023 at 4:06 PM Ruediger Pluem <[email protected]> wrote:
>
> On 3/14/23 3:37 PM, [email protected] wrote:
> > Author: ylavic
> > Date: Tue Mar 14 14:37:00 2023
> > New Revision: 1908388
> >
> > URL: http://svn.apache.org/viewvc?rev=1908388&view=rev
> > Log:
> > core: Use the main ErrorLogFormat for ap_log_perror() and while loading
> > vhosts.
> >
> > * server/core.c(create_core_server_config):
> > Init sconf->error_log_format early so that it applies while the vhost
> > is loading.
> >
> > * server/log.c(log_error_core):
> > Get the core_server_config from the main server if no server/config is
> > provided.
[]
> >
> > +++ httpd/httpd/trunk/server/log.c Tue Mar 14 14:37:00 2023
> > @@ -1098,6 +1098,9 @@ static void log_error_core(const char *f
> > errorlog_provider = ap_server_conf->errorlog_provider;
> > errorlog_provider_handle =
> > ap_server_conf->errorlog_provider_handle;
> > }
> > +
> > + /* Use the main ErrorLogFormat if any */
> > + sconf = ap_get_core_module_config(ap_server_conf->module_config);
>
> The code above checks for ap_server_conf != NULL. Should we apply this here
> as well or can we be sure that ap_server_conf is
> always non NULL?
Yes, can still be NULL here, thanks! Fixed in r1908390.
Also in r1908393 I tried to set ap_server_conf ASAP, for anything
logged during ap_read_config()..
>
> > }
> > else {
> > int configured_level = r ? ap_get_request_module_loglevel(r,
> > module_index) :
> > @@ -1145,6 +1148,10 @@ static void log_error_core(const char *f
> > }
> > }
> > }
> > + else {
> > + /* Use the main ErrorLogFormat if any */
> > + sconf =
> > ap_get_core_module_config(ap_server_conf->module_config);
> > + }
> > }
> >
> > if (!logf && !(errorlog_provider && errorlog_provider_handle)) {
> > @@ -1215,7 +1222,7 @@ static void log_error_core(const char *f
> > info.file = file;
> > info.line = line;
> > info.status = status;
> > - log_format = sconf ? sconf->error_log_format : NULL;
> > + log_format = sconf->error_log_format;
>
> If we would follow my comment above and check for ap_server_conf != NULL.
> this check would still be needed.
Restored in r1908390 too.
Regards;
Yann.