Bug 55192

Summary: htaccess error messages missing request context
Product: Apache httpd-2 Reporter: Dave <apache-b6e>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: trivial Keywords: PatchAvailable
Priority: P2    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Make request_rec information available to htaccess error logging

Description Dave 2013-07-03 13:53:00 UTC
Created attachment 30531 [details]
Make request_rec information available to htaccess error logging

Error logging for .htaccess is missing request information.

This information is not available to ErrorLogFormat as the request_rec is not passed in (for example, on vhost aliasing, %V cannot find the request host and so makes determining where an error was generated impossible)

As part of the changes for PR 52439, the very common .htaccess errors AH02295 and AH02296 are now logged locally inside invoke_cmd and ap_walk_config_sub. Since no associated request_rec is available, these are logged using ap_log_perror().

One possible solution is to add the request_rec to cmd_parms and use ap_log_rerror() when available. However, as this changes the API it may not be desirable. I've attached a rough patch demonstrating this workaround.

Example:

ErrorLogFormat "%-V [%{c}t] [%-m:%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i""

Before:

- [2013-07-03 00:46:02] [core:warn] AH02295: Options in .htaccess forbidden by AllowOverride

After:

somedomain.com [2013-07-03 14:47:56] [core:warn] [client X.X.X.X:Y] AH02295: Options in .htaccess forbidden by AllowOverride, referer http://somedomain.com/somefile.html