]> granicus.if.org Git - apache/commitdiff
mod_log_config: %{hextid}P will log the thread id in hex with APR
authorJeff Trawick <trawick@apache.org>
Wed, 31 Aug 2005 12:34:07 +0000 (12:34 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 31 Aug 2005 12:34:07 +0000 (12:34 +0000)
versions 1.2.0 or higher.

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

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

diff --git a/CHANGES b/CHANGES
index c0135e532805f74f0ba9f975a0525e19c0e53afa..3f2caf8ac65c1de58e8d887837d45d532793a81e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) mod_log_config: %{hextid}P will log the thread id in hex with APR
+     versions 1.2.0 or higher.  [Jeff Trawick]
+
   *) mod_cgid: Refuse to work on Solaris 10 due to OS bugs.  PR 34264.
      [Justin Erenkrantz]
 
index 2f623ca3861c42de7c3e2b0910f16e4b05ed7b12..d3852671591f4a0ecd885f302794d9c003c2c23a 100644 (file)
 
     <tr><td><code>%{<var>format</var>}P</code></td>
         <td>The process ID or thread id of the child that serviced the 
-        request.  Valid formats are <code>pid</code> and <code>tid</code>.
+        request.  Valid formats are <code>pid</code>, <code>tid</code>,
+        and <code>hextid</code>.  <code>hextid</code> requires APR 1.2.0 or 
+        higher.
         </td></tr>
 
     <tr><td><code>%q</code></td>
index b8900683e60926982045030b61be7b82253e86fb..718441d7141b7d99c52225e1eb539b9e742634b4 100644 (file)
@@ -650,13 +650,21 @@ static const char *log_pid_tid(request_rec *r, char *a)
     if (*a == '\0' || !strcmp(a, "pid")) {
         return apr_psprintf(r->pool, "%" APR_PID_T_FMT, getpid());
     }
-    else if (!strcmp(a, "tid")) {
+    else if (!strcmp(a, "tid") || !strcmp(a, "hextid")) {
 #if APR_HAS_THREADS
         apr_os_thread_t tid = apr_os_thread_current();
 #else
         int tid = 0; /* APR will format "0" anyway but an arg is needed */
 #endif
-        return apr_psprintf(r->pool, "%pT", &tid);
+        return apr_psprintf(r->pool,
+#if APR_MAJOR_VERSION > 1 || (APR_MAJOR_VERSION == 1 && APR_MINOR_VERSION >= 2)
+                            /* APR can format a thread id in hex */
+                            *a == 'h' ? "%pt" : "%pT",
+#else
+                            /* APR is missing the feature, so always use decimal */
+                            "%pT",
+#endif
+                            &tid);
     }
     /* bogus format */
     return a;