]> granicus.if.org Git - apache/commitdiff
mod_log_config: Add the ability to log the id of the thread
authorJeff Trawick <trawick@apache.org>
Fri, 18 Apr 2003 10:44:11 +0000 (10:44 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 18 Apr 2003 10:44:11 +0000 (10:44 +0000)
processing the request (%I).

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

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

diff --git a/CHANGES b/CHANGES
index 03a8eaed47ac3e9732be29b0c63898fbdd7f1615..fbffb8627d668c5fd0c4041417ff44843824d8d9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_log_config: Add the ability to log the id of the thread 
+     processing the request (%I).  [Jeff Trawick]
+
   *) Fix a problem that caused httpd to linked with incorrect flags
      on some platforms when mod_so was enabled by default, breaking 
      DSOs on AIX.  PR 19012  [Jeff Trawick]
index 1ce35db11326101983176ddca2878409575d0337..62624559e22bfd01bea18174e83463eef41e4e2e 100644 (file)
         <td>Remote host</td></tr>
 <tr><td><code>%...H</code></td>
         <td>The request protocol</td></tr>
-<tr class="odd"><td><code>%...{<var>Foobar</var>}i</code></td>
+<tr class="odd"><td><code>%...I</code></td>
+        <td>The thread id if APR supports threads, otherwise 0</td></tr>
+<tr><td><code>%...{<var>Foobar</var>}i</code></td>
         <td>The contents of <code><var>Foobar</var>:</code> header line(s)
         in the request sent to the server.</td></tr>
-<tr><td><code>%...l</code></td>
+<tr class="odd"><td><code>%...l</code></td>
         <td>Remote logname (from identd, if supplied). This will return a
         dash unless <code class="module"><a href="../mod/mod_ident.html">mod_ident</a></code> is present and <code class="directive"><a href="../mod/mod_ident.html#identitycheck">IdentityCheck</a></code> is set
         <code>On</code>.</td></tr>
-<tr class="odd"><td><code>%...m</code></td>
+<tr><td><code>%...m</code></td>
         <td>The request method</td></tr>
-<tr><td><code>%...{<var>Foobar</var>}n</code></td>
+<tr class="odd"><td><code>%...{<var>Foobar</var>}n</code></td>
         <td>The contents of note <var>Foobar</var> from another
         module.</td></tr>
-<tr class="odd"><td><code>%...{<var>Foobar</var>}o</code></td>
+<tr><td><code>%...{<var>Foobar</var>}o</code></td>
         <td>The contents of <code><var>Foobar</var>:</code> header line(s)
         in the reply.</td></tr>
-<tr><td><code>%...p</code></td>
+<tr class="odd"><td><code>%...p</code></td>
         <td>The canonical port of the server serving the request</td></tr>
-<tr class="odd"><td><code>%...P</code></td>
+<tr><td><code>%...P</code></td>
         <td>The process ID of the child that serviced the request.</td></tr>
-<tr><td><code>%...q</code></td>
+<tr class="odd"><td><code>%...q</code></td>
         <td>The query string (prepended with a <code>?</code> if a query
         string exists, otherwise an empty string)</td></tr>
-<tr class="odd"><td><code>%...r</code></td>
+<tr><td><code>%...r</code></td>
         <td>First line of request</td></tr>
-<tr><td><code>%...s</code></td>
+<tr class="odd"><td><code>%...s</code></td>
         <td>Status. For requests that got internally redirected, this is
         the status of the *original* request --- <code>%...&gt;s</code>
         for the last.</td></tr>
-<tr class="odd"><td><code>%...t</code></td>
+<tr><td><code>%...t</code></td>
         <td>Time, in common log format time format (standard english
         format)</td></tr>
-<tr><td><code>%...{<var>format</var>}t</code></td>
+<tr class="odd"><td><code>%...{<var>format</var>}t</code></td>
         <td>The time, in the form given by format, which should be in
         <code>strftime(3)</code> format. (potentially localized)</td></tr>
-<tr class="odd"><td><code>%...T</code></td>
+<tr><td><code>%...T</code></td>
         <td>The time taken to serve the request, in seconds.</td></tr>
-<tr><td><code>%...u</code></td>
+<tr class="odd"><td><code>%...u</code></td>
         <td>Remote user (from auth; may be bogus if return status
         (<code>%s</code>) is 401)</td></tr>
-<tr class="odd"><td><code>%...U</code></td>
+<tr><td><code>%...U</code></td>
         <td>The URL path requested, not including any query string.</td></tr>
-<tr><td><code>%...v</code></td>
+<tr class="odd"><td><code>%...v</code></td>
         <td>The canonical <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>
         of the server serving the request.</td></tr>
-<tr class="odd"><td><code>%...V</code></td>
+<tr><td><code>%...V</code></td>
         <td>The server name according to the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code> setting.</td></tr>
-<tr><td><code>%...X</code></td>
+<tr class="odd"><td><code>%...X</code></td>
         <td>Connection status when response is completed:
 
         <table>
         <p>(This directive was <code>%...c</code> in late versions of Apache
         1.3, but this conflicted with the historical ssl
         <code>%...{<var>var</var>}c</code> syntax.)</p></td></tr>
-<tr class="odd"><td><code>%...I</code></td>
+<tr><td><code>%...I</code></td>
         <td>Bytes received, including request and headers, cannot be zero.
         You need to enable <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr>
-<tr><td><code>%...O</code></td>
+<tr class="odd"><td><code>%...O</code></td>
         <td>Bytes sent, including headers, cannot be zero. You need to
         enable <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr>
 </table>
index 55a0a573c4ec0d5e6caaea88e88cb6cbad5ee785..846f6c0041ce6ebb34091aacf9407eb4cd12d435 100644 (file)
@@ -83,6 +83,9 @@
     <tr><td><code>%...H</code></td>
         <td>The request protocol</td></tr>
 
+    <tr><td><code>%...I</code></td>
+        <td>The thread id if APR supports threads, otherwise 0</td></tr>
+
     <tr><td><code>%...{<var>Foobar</var>}i</code></td>
         <td>The contents of <code><var>Foobar</var>:</code> header line(s)
         in the request sent to the server.</td></tr>
index 0e28ac5f99ffbc866b7a8f61d15f42890eb97450..9b4627a801d1732254d49d7efb3a7fa849920fd3 100644 (file)
  * %...{Foobar}o:  The contents of Foobar: header line(s) in the reply.
  * %...p:  the port the request was served to
  * %...P:  the process ID of the child that serviced the request.
+ * %...I:  the thread ID of the thread that serviced the request (or
+ *         0 if APR doesn't support threads)
  * %...r:  first line of request
  * %...s:  status.  For requests that got internally redirected, this
  *         is status of the *original* request --- %...>s for the last.
@@ -616,6 +618,17 @@ static const char *log_child_pid(request_rec *r, char *a)
     return apr_psprintf(r->pool, "%ld", (long) getpid());
 }
 
+static const char *log_tid(request_rec *r, char *a)
+{
+#if APR_HAS_THREADS
+    apr_os_thread_t tid = apr_os_thread_current();
+
+    return apr_psprintf(r->pool, "%pT", &tid);
+#else
+    return "0";
+#endif
+}
+
 static const char *log_connection_status(request_rec *r, char *a)
 {
     if (r->connection->aborted)
@@ -1381,6 +1394,7 @@ static int log_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
         log_pfn_register(p, "v", log_virtual_host, 0);
         log_pfn_register(p, "p", log_server_port, 0);
         log_pfn_register(p, "P", log_child_pid, 0);
+        log_pfn_register(p, "I", log_tid, 0);
         log_pfn_register(p, "H", log_request_protocol, 0);
         log_pfn_register(p, "m", log_request_method, 0);
         log_pfn_register(p, "q", log_request_query, 0);