]> granicus.if.org Git - apache/commitdiff
Add new LogFormat directive, %D, to log time it takes to serve a request
authorBill Stoddard <stoddard@apache.org>
Sat, 10 Feb 2001 03:38:48 +0000 (03:38 +0000)
committerBill Stoddard <stoddard@apache.org>
Sat, 10 Feb 2001 03:38:48 +0000 (03:38 +0000)
in microseconds.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88046 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_log_config.html
modules/loggers/mod_log_config.c

diff --git a/CHANGES b/CHANGES
index acfd169270c9c380445d814b2b99c6e090aa9090..9d708844a868236122aa528751fad15af5c08a2d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,6 @@
 Changes with Apache 2.0b1
+  *) Add new LogFormat directive, %D, to log time it takes to serve a
+     request in microseconds. [Bill Stoddard]
 
   *) Change AddInputFilter and AddOutputFilter to SetInputFilter and
      SetOutputFilter.  This corresponds nicely with the other Set 
index 744d61219e53cf8b0b6395d678ff52f86b2e010a..f90dffd14057e41943f94c453db8f52b42134353 100644 (file)
@@ -137,6 +137,7 @@ by the values as follows:</p>
                 '-' = connection will be closed after the response is sent.
 %...{Foobar}C: The contents of cookie "Foobar" in the request sent to the
                 server.
+%...D:          The time taken to serve the request, in microseconds.
 %...{FOOBAR}e:  The contents of the environment variable FOOBAR
 %...f:          Filename
 %...h:          Remote host
index 16c9f526cc817e1c43d79ca0e0f6f43f48fdfa14..6b103aae7abb4b49478ea5aaa2acf90bfe4dbab7 100644 (file)
  * %...{format}t:  The time, in the form given by format, which should
  *                 be in strftime(3) format.
  * %...T:  the time taken to serve the request, in seconds.
+ * %...D:  the time taken to serve the request, in micro seconds.
  * %...u:  remote user (from auth; may be bogus if return status (%s) is 401)
  * %...U:  the URL path requested.
  * %...v:  the configured name of the server (i.e. which virtual host?)
@@ -490,6 +491,11 @@ static const char *log_request_duration(request_rec *r, char *a)
                                              / APR_USEC_PER_SEC);
 }
 
+static const char *log_request_duration_microseconds(request_rec *r, char *a)
+{
+    return apr_psprintf(r->pool, "%ld", (apr_time_now() - r->request_time));
+}
+
 /* These next two routines use the canonical name:port so that log
  * parsers don't need to duplicate all the vhost parsing crud.
  */
@@ -617,6 +623,9 @@ static struct log_item_list {
     {
         'C', log_cookie, 0
     },
+    {
+        'D', log_request_duration_microseconds, 1
+    },
     {
         '\0'
     }