Bug 56517 - Virtualhosts cannot inherit parent CustomLog
Summary: Virtualhosts cannot inherit parent CustomLog
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_log_config (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2014-05-12 20:25 UTC by Edward Lu
Modified: 2016-12-31 00:36 UTC (History)
0 users



Attachments
Add GlobalLog directive (2.62 KB, patch)
2014-05-12 20:25 UTC, Edward Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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