Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat log: what's the difference between %D and %F

I am using tomcat log to log the access info and the definitions of %D and %F in official doc is

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

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

I am confused by this two definitions, does the time of %F includes the time of %D?

Thanks in advance!

like image 351
Minky Avatar asked Mar 09 '17 02:03

Minky


People also ask

What is AccessLogValve?

public class AccessLogValve extends ValveBase implements AccessLog. Implementation of the Valve interface that generates a web server access log with the detailed line contents matching a configurable pattern.

What is log file in Tomcat?

This file is located in the logs directory below the Tomcat root directory. This log is the system's output log, which also consists of standard error messages. These files are saved daily (MM-DD-YYYY) with the date appended to the name of the data. Moreover, this log file persists during the functioning of the server.


1 Answers

%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 entry for %F it says https://bz.apache.org/bugzilla/show_bug.cgi?id=55102

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).

like image 182
rince Avatar answered Nov 30 '22 15:11

rince