Bug 56517

Summary: Virtualhosts cannot inherit parent CustomLog
Product: Apache httpd-2 Reporter: Edward Lu <Chaosed0>
Component: mod_log_configAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: FixedInTrunk, PatchAvailable
Priority: P2    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Add GlobalLog directive

Description Edward Lu 2014-05-12 20:25:17 UTC
Created attachment 31612 [details]
Add GlobalLog directive

A virtualhost can specify its own CustomLog directives, but when this is done, the vhost no longer uses the parent CustomLog directives. From a comment in the source, this was apparently done purposefully. However, it seems that there should be some mechanism for allowing virtualhosts to inherit the CustomLog of the parent configuration.

At first, I tried to add another optional parameter to CustomLog, but it turned out to be somewhat more complicated than I'd anticipated; CustomLog already has an optional parameter, and the AP_INIT_TAKE macros only go up to 3 parameters. As an alternative, the patch attached introduces a new directive, GlobalLog, which is essentially equivalent to CustomLog except that all child virtualhosts also inherit the log.
Comment 1 Yann Ylavic 2014-05-14 14:34:40 UTC
Why override CustomLog in the vhost at first?
All httpd's vhost directives are based on this override logic, why would it be different for CustomLog?

If you want the vhost to use the parent's CustomLog, simply don't declare one for it.
Comment 2 Eric Covener 2014-05-14 15:04:17 UTC
I expressed the requirement off-line to Ed.

I often I want to give a user a copy/pasteable logging directive with all sorts of custom formats early during problem determination.  It would be handy if they could append it to their configuration and have it used for all of their responses, rather than having them update N+1 contexts with n+1 filenames or determine what vhost is having the problem [and hope the problem is not related to vhosts]
Comment 3 Eric Covener 2016-12-31 00:36:37 UTC
GlobalLog available in 2.4.19 and later