Bug 45823 - AccessLogValve doesn't correctly handles combined log format (with patch)
Summary: AccessLogValve doesn't correctly handles combined log format (with patch)
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.16
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-17 02:20 UTC by Per Landberg
Modified: 2008-09-19 04:06 UTC (History)
0 users



Attachments
Patch that corrects this bug (473 bytes, patch)
2008-09-17 02:20 UTC, Per Landberg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Landberg 2008-09-17 02:20:05 UTC
Created attachment 22595 [details]
Patch that corrects this bug

When configuring the AccessLogValve valve to use the combined log format and either referer or user-agent fields are unavailable in the request, the corresponding log entry fields will contain "(null)" instead of "-". This behaviour breaks access log analyzers like AWStats and I believe it's also a violation of the log spec.

Included is a patch that I believe will correct the problem. The patch make sure that any non-existing header will be logged as '-' instead of trying to log a null pointer.

I stumbled on this problem when upgrading from Tomcat 5.5 to 6.0.16 using Debian etch and JDK 6. Tomcat 5.5 didn't suffer from this issue.

I haven't yet tried Tomcat 6.0.18 but the AccessLogValve.java file seems to be unchanged between the two releases so I suspect the problem still exists.
Comment 1 Mark Thomas 2008-09-17 03:58:39 UTC
Thanks for the report and the patch. I have applied a slightly modified patch to trunk and proposed it for 6.0.x.
Comment 2 Mark Thomas 2008-09-19 04:06:37 UTC
This has been committed to 6.0.x and will be included in 6.0.19 onwards.

Thanks again for the patch.