[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]
+ processing the request via new %P formats. [Jeff Trawick]
*) Fix a problem that caused httpd to linked with incorrect flags
on some platforms when mod_so was enabled by default, breaking
<td>Remote host</td></tr>
<tr><td><code>%...H</code></td>
<td>The request protocol</td></tr>
-<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>
+<tr class="odd"><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 class="odd"><td><code>%...l</code></td>
+<tr><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><td><code>%...m</code></td>
+<tr class="odd"><td><code>%...m</code></td>
<td>The request method</td></tr>
-<tr class="odd"><td><code>%...{<var>Foobar</var>}n</code></td>
+<tr><td><code>%...{<var>Foobar</var>}n</code></td>
<td>The contents of note <var>Foobar</var> from another
module.</td></tr>
-<tr><td><code>%...{<var>Foobar</var>}o</code></td>
+<tr class="odd"><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 class="odd"><td><code>%...p</code></td>
+<tr><td><code>%...p</code></td>
<td>The canonical port of the server serving the request</td></tr>
-<tr><td><code>%...P</code></td>
+<tr class="odd"><td><code>%...P</code></td>
<td>The process ID of the child that serviced the request.</td></tr>
+<tr><td><code>%...{<var>format</var>}P</code></td>
+ <td>The process ID and or thread id of the child that serviced the
+ request. Valid formats are <code>pid</code>, <code>tid</code>,
+ and <code>pid/tid</code>.</td></tr>
<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><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>
<tr><td><code>%...P</code></td>
<td>The process ID of the child that serviced the request.</td></tr>
+ <tr><td><code>%...{<var>format</var>}P</code></td>
+ <td>The process ID and or thread id of the child that serviced the
+ request. Valid formats are <code>pid</code>, <code>tid</code>,
+ and <code>pid/tid</code>.</td></tr>
+
<tr><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>
return ap_escape_logitem(r->pool, ap_get_server_name(r));
}
-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)
+static const char *log_pid_tid(request_rec *r, char *a)
{
+ if (*a == '\0' || !strcmp(a, "pid")) {
+ return apr_psprintf(r->pool, "%ld", (long)getpid());
+ }
+ else {
#if APR_HAS_THREADS
- apr_os_thread_t tid = apr_os_thread_current();
-
- return apr_psprintf(r->pool, "%pT", &tid);
+ apr_os_thread_t tid = apr_os_thread_current();
#else
- return "0";
+ int tid = 0; /* APR will format "0" anyway but an arg is needed */
#endif
+
+ if (!strcmp(a, "pid/tid")) {
+ return apr_psprintf(r->pool, "%ld/%pT", (long)getpid(), &tid);
+ }
+ else if (!strcmp(a, "tid")) {
+ return apr_psprintf(r->pool, "%pT", &tid);
+ }
+ else { /* bogus string */
+ return a;
+ }
+ }
}
static const char *log_connection_status(request_rec *r, char *a)
log_pfn_register(p, "V", log_server_name, 0);
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, "P", log_pid_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);