Commit b3dfaa9f authored by Jeff Trawick's avatar Jeff Trawick
Browse files

mod_log_config: %{hextid}P will log the thread id in hex with APR

versions 1.2.0 or higher.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@265033 13f79535-47bb-0310-9956-ffa450edef68
parent d0d50951
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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]
+3 −1
Original line number Diff line number Diff line
@@ -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>
+10 −2
Original line number Diff line number Diff line
@@ -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;