I am trying to achieve consistent log formats between HTTPd and Tomcat. Unfortunately, there are subtle differences between conversion patterns. In Tomcat I have "%h %u %{yyyy-MM-dd'T'HH:mm:ss.SSS}t "%r" %s %b %T" In HTTPd I have "%h %u %{%FT%T}t.%{msec_frac}t \"%r\" %>s %b %{ms}T" now the inconsistencies: %D: In Tomcat it is millisecond resolution, HTTPd microsecond resolution %T: both in second resolution, but Tomcat used floating point while HTTPd uses integers %{UNIT}T does not exist on Tomcat at all. Granted. This all feels weird probably for most having different semantics for the same pattern. I think this needs to be aligned, or at least documented!
Also see bug 56966. I don't recall why that stalled. It may have been related to the API changes required. Probably time to take another look.
(In reply to Mark Thomas from comment #1) > Also see bug 56966. I don't recall why that stalled. It may have been > related to the API changes required. Probably time to take another look. It looks related, but the issue you mention is about resolution, this one's different. Three years have passed since the ticket has been touched.
We can't change the behaviour in the middle of the 9.0.x series. The risk of braking things for users is too great. I've added it to the TODO list for 10.0.x. Meanwhile, we can clearly document the current behaviour and note the differences with httpd. Working on that now...
That's fine by me. Though, %{UNIT}T can be introduced in 8.5 and 9, can't it?
The documentation has been fixed in: - master for 9.0.18 onwards - 8.5.x for 8.5.40 onwards - 7.0.x for 7.0.94 onwards Moving this to enhancement request to add support for %{UNIT}T
There's another difference between httpd and Tomcat access logs that people often stumble upon: By default the request timestamp for httpd is the time of the beginning of the request, for Tomcat it is the end of the requst (or more precisely the moment of peparing the access log line). Since httpd 2.4 and TC 7 (?) one can choose between begin and end with a documented pattern, but the defaults still differ. The delta makes it harder to align the logs in case of long running requests. One consequence is, that the timestamp in Tomcat access logs always increase monotonically, but not so in httpd access log. Later but faster requests might get logged before earlier but slower requests. Should we document this as well? Regards, Rainer
This should be fixed in 10.0.0-M2.
(In reply to Remy Maucherat from comment #7) > This should be fixed in 10.0.0-M2. I fail to find this commit in https://github.com/apache/tomcat/commits/master/java/org/apache/catalina/valves/AccessLogValve.java and https://github.com/apache/tomcat/commits/master/java/org/apache/catalina/valves/AbstractAccessLogValve.java. Where is it?
AccessLogValve was not doing anything related. The argument that used milliseconds was in AbstractALV, now it uses nanoseconds.
Let me recheck this. I hope docs have been updated too.
(In reply to Remy Maucherat from comment #9) > AccessLogValve was not doing anything related. The argument that used > milliseconds was in AbstractALV, now it uses nanoseconds. Rémy, I have updated documentation to reflect your changes.