You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2005/08/31 14:34:15 UTC

svn commit: r265033 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_log_config.xml modules/loggers/mod_log_config.c

Author: trawick
Date: Wed Aug 31 05:34:07 2005
New Revision: 265033

URL: http://svn.apache.org/viewcvs?rev=265033&view=rev
Log:
mod_log_config: %{hextid}P will log the thread id in hex with APR
versions 1.2.0 or higher.

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=265033&r1=265032&r2=265033&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Aug 31 05:34:07 2005
@@ -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]
 

Modified: httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml?rev=265033&r1=265032&r2=265033&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml Wed Aug 31 05:34:07 2005
@@ -132,7 +132,9 @@
 
     <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>

Modified: httpd/httpd/trunk/modules/loggers/mod_log_config.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/loggers/mod_log_config.c?rev=265033&r1=265032&r2=265033&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_config.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_config.c Wed Aug 31 05:34:07 2005
@@ -650,13 +650,21 @@
     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;