httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1680942 - in /httpd/httpd/trunk: docs/manual/mod/mod_log_config.xml modules/loggers/mod_log_config.c
Date Thu, 21 May 2015 19:20:45 GMT
Author: trawick
Date: Thu May 21 19:20:44 2015
New Revision: 1680942

URL: http://svn.apache.org/r1680942
Log:
Follow-up to r1680895:

Let %T be the format character which accepts time resolution
arguments.

Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
    httpd/httpd/trunk/modules/loggers/mod_log_config.c

Modified: httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml?rev=1680942&r1=1680941&r2=1680942&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml Thu May 21 19:20:44 2015
@@ -95,15 +95,6 @@
     <tr><td><code>%D</code></td>
         <td>The time taken to serve the request, in microseconds.</td></tr>
 
-    <tr><td><code>%{<var>UNIT</var>}D</code></td>
-        <td>The time taken to serve the request, in a time unit given by
-        <code>UNIT</code>. Valid units are <code>ms</code> for milliseconds,
-        <code>us</code> for microseconds and <code>s</code> for seconds.
-        Using <code>us</code> gives the same result as <code>%D</code>
-        without any format, using <code>s</code> gives teh same result
-        as <code>%T</code>. Combining <code>%D</code> with a unit
is
-        available in 2.4.13 and later.</td></tr>
-
     <tr><td><code>%{<var>VARNAME</var>}e</code></td>
         <td>The contents of the environment variable
         <var>VARNAME</var>.</td></tr>
@@ -225,6 +216,15 @@
     <tr><td><code>%T</code></td>
         <td>The time taken to serve the request, in seconds.</td></tr>
 
+    <tr><td><code>%{<var>UNIT</var>}T</code></td>
+        <td>The time taken to serve the request, in a time unit given by
+        <code>UNIT</code>. Valid units are <code>ms</code> for milliseconds,
+        <code>us</code> for microseconds, and <code>s</code> for
seconds.
+        Using <code>s</code> gives the same result as <code>%T</code>
+        without any format; using <code>us</code> gives the same result
+        as <code>%D</code>. Combining <code>%T</code> with a unit
is
+        available in 2.4.13 and later.</td></tr>
+
     <tr><td><code>%u</code></td>
         <td>Remote user if the request was authenticated. May be bogus if return status
         (<code>%s</code>) is 401 (unauthorized).</td></tr>

Modified: httpd/httpd/trunk/modules/loggers/mod_log_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_config.c?rev=1680942&r1=1680941&r2=1680942&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_config.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_config.c Thu May 21 19:20:44 2015
@@ -101,10 +101,10 @@
  * %...{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.
+ * %...{s}T:  the time taken to serve the request, in seconds, same as %T.
+ * %...{us}T:  the time taken to serve the request, in micro seconds, same as %D.
+ * %...{ms}T:  the time taken to serve the request, in milliseconds.
  * %...D:  the time taken to serve the request, in micro seconds.
- * %...{s}D:  the time taken to serve the request, in seconds, same as %T.
- * %...{us}D:  the time taken to serve the request, in micro seconds, same as %D.
- * %...{ms}D:  the time taken to serve the request, in milliseconds.
  * %...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?)
@@ -799,22 +799,22 @@ static const char *log_request_time(requ
     }
 }
 
-static const char *log_request_duration(request_rec *r, char *a)
-{
-    apr_time_t duration = get_request_end_time(r) - r->request_time;
-    return apr_psprintf(r->pool, "%" APR_TIME_T_FMT, apr_time_sec(duration));
+static const char *log_request_duration_microseconds(request_rec *r, char *a)
+{    
+    return apr_psprintf(r->pool, "%" APR_TIME_T_FMT,
+                        (get_request_end_time(r) - r->request_time));
 }
 
 static const char *log_request_duration_scaled(request_rec *r, char *a)
 {
     apr_time_t duration = get_request_end_time(r) - r->request_time;
-    if (*a == '\0' || !strcasecmp(a, "us")) {
+    if (*a == '\0' || !strcasecmp(a, "s")) {
+        duration = apr_time_sec(duration);
     }
     else if (!strcasecmp(a, "ms")) {
         duration = apr_time_as_msec(duration);
     }
-    else if (!strcasecmp(a, "s")) {
-        duration = apr_time_sec(duration);
+    else if (!strcasecmp(a, "us")) {
     }
     else {
         /* bogus format */
@@ -1851,8 +1851,8 @@ static int log_pre_config(apr_pool_t *p,
         log_pfn_register(p, "C", log_cookie, 0);
         log_pfn_register(p, "k", log_requests_on_connection, 0);
         log_pfn_register(p, "r", log_request_line, 1);
-        log_pfn_register(p, "D", log_request_duration_scaled, 1);
-        log_pfn_register(p, "T", log_request_duration, 1);
+        log_pfn_register(p, "D", log_request_duration_microseconds, 1);
+        log_pfn_register(p, "T", log_request_duration_scaled, 1);
         log_pfn_register(p, "U", log_request_uri, 1);
         log_pfn_register(p, "s", log_status, 1);
         log_pfn_register(p, "R", log_handler, 1);



Mime
View raw message