Bug 65629 - ErrorLogFormat not applied when starting the http server
Summary: ErrorLogFormat not applied when starting the http server
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.51
Hardware: PC
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-12 12:42 UTC by dieuapache
Modified: 2021-10-12 12:42 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dieuapache 2021-10-12 12:42:05 UTC
Hi,

I configured ErrorLogFormat :
ErrorLogFormat "{ \"soft\":\"apache\", \"type\":\"error\", \"log_level\":\"%l\", \"date_time\":\"%{u}t\", \"pid\":\"%P\", \"tid\":\"%T\", \"source_file_name\":\"%F\", \"status_apr_os\":\"%E\", \"client_ip_port\":\"%a\", \"message\":\"%M\" }"

but when the Apache server start with an error in the configuration, ErrorLogFormat is not applied. However, we can see that it applies the correct ErrorLogFormat once it has finished starting.

My conf with generate error :
<If "-n %{ENV:CSP}">
Header always set Content-Security-Policy "${CSP}"
</If>

Logs :
[Tue Oct 12 14:15:34.227029 2021] [core:warn] [pid 17:tid 140499561490240] AH00111: Config variable ${CSP} is not defined
[Tue Oct 12 14:15:34.281539 2021] [core:warn] [pid 1:tid 139760303707968] AH00111: Config variable ${CSP} is not defined
[Tue Oct 12 14:15:34.285869 2021] [core:warn] [pid 1:tid 139760303707968] AH00111: Config variable ${CSP} is not defined
{ "soft":"apache", "type":"error", "log_level":"notice", "date_time":"Tue Oct 12 14:15:34.288189 2021", "pid":"1", "tid":"139760303707968", "source_file_name":"event.c(3163)", "message":"AH00489: Apache/2.4.51 (Unix) OpenSSL/1.1.1l configured -- resuming normal operations" }
{ "soft":"apache", "type":"error", "log_level":"notice", "date_time":"Tue Oct 12 14:15:34.288228 2021", "pid":"1", "tid":"139760303707968", "source_file_name":"log.c(1564)", "message":"AH00094: Command line: 'httpd -D FOREGROUND'" }

The last 2 lines are in the correct format, while the first 3 lines are in another format.... which should not be the case.
All logs should be in the format which is defined by ErrorLogFormat.

Thanks for correction.