Tomcat log: What's the difference between %D and %F?
Asked Answered
E

2

9

I am using Tomcat log to log the access info. And the definitions of %D and %F in official doc are:

  • %D - Time taken to process the request, in millis

  • %F - Time taken to commit the response, in millis

I am confused by these two definitions. Does the time of %F include the time of %D?

Eufemiaeugen answered 9/3, 2017 at 2:39 Comment(0)
I
13

%D includes %F plus any network time

There is a bit more information in the API Doc https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/valves/AccessLogValve.html

AccessLogValve.ElapsedTimeElement write time taken to process the request - %D, %T

AccessLogValve.FirstByteTimeElement write time until first byte is written (commit time) in millis - %F

In the Bugzilla 55102 entry for %F it says:

Tomcat's AccessLogValve is able to report the time taken to send an entire request using %D. This is the total processing time and may be affected by network conditions. It is sometimes useful to be able to record the time taken by the server to prepare the response and send the first content to the client.

Attached is a patch that records the time the response is committed and then allows that to be reported in the access log using a %F pattern (which is the same as used by the mod-log-firstbyte module for HTTPD).

Irrefragable answered 2/5, 2017 at 18:18 Comment(0)
R
3

FYI, the unit for %D in tomcat 8 is millisecond, while in tomcat 10 it's microsecond...

So %{ms}T in tomcat 10 could be used as a equivalence for %D in tomcat 8.

Ringler answered 23/10, 2023 at 9:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.