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 2003/04/18 12:44:11 UTC

cvs commit: httpd-2.0/modules/loggers mod_log_config.c

trawick     2003/04/18 03:44:11

  Modified:    .        CHANGES
               docs/manual/mod mod_log_config.html.en mod_log_config.xml
               modules/loggers mod_log_config.c
  Log:
  mod_log_config: Add the ability to log the id of the thread
  processing the request (%I).
  
  Revision  Changes    Path
  1.1149    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1148
  retrieving revision 1.1149
  diff -u -r1.1148 -r1.1149
  --- CHANGES	17 Apr 2003 21:32:27 -0000	1.1148
  +++ CHANGES	18 Apr 2003 10:44:10 -0000	1.1149
  @@ -2,6 +2,9 @@
   
     [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]
  
  
  
  1.29      +22 -20    httpd-2.0/docs/manual/mod/mod_log_config.html.en
  
  Index: mod_log_config.html.en
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_log_config.html.en,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mod_log_config.html.en	14 Apr 2003 18:05:26 -0000	1.28
  +++ mod_log_config.html.en	18 Apr 2003 10:44:11 -0000	1.29
  @@ -97,53 +97,55 @@
           <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>
  @@ -160,10 +162,10 @@
           <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>
  
  
  
  1.20      +3 -0      httpd-2.0/docs/manual/mod/mod_log_config.xml
  
  Index: mod_log_config.xml
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_log_config.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_log_config.xml	11 Apr 2003 01:25:52 -0000	1.19
  +++ mod_log_config.xml	18 Apr 2003 10:44:11 -0000	1.20
  @@ -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>
  
  
  
  1.102     +14 -0     httpd-2.0/modules/loggers/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/mod_log_config.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- mod_log_config.c	20 Mar 2003 21:50:39 -0000	1.101
  +++ mod_log_config.c	18 Apr 2003 10:44:11 -0000	1.102
  @@ -134,6 +134,8 @@
    * %...{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 @@
       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 @@
           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);
  
  
  

Re: cvs commit: httpd-2.0/modules/loggers mod_log_config.c

Posted by André Malo <nd...@perlig.de>.
* Jeff Trawick wrote:

> André Malo wrote:
>> %I is already used by mod_logio...
> now I see that at least the doc of mod_log_config mentions that, but as
> those were the only entries not in alphabetical order I didn't see them

Oh well, we should reorder it. I see no reason why they should be 
separated.

> %...P           process id only              12345
> %...{pid}P      process id only              12345
> %...{tid}P      thread id only               14002
> %...{pid+tid}P  process id and thread id     12345/14002

+1.

nd
-- 
my @japh = (sub{q~Just~},sub{q~Another~},sub{q~Perl~},sub{q~Hacker~});
my $japh = q[sub japh { }]; print join       #########################
 [ $japh =~ /{(.)}/] -> [0] => map $_ -> ()  #            André Malo #
=> @japh;                                    # http://pub.perlig.de/ #

Re: cvs commit: httpd-2.0/modules/loggers mod_log_config.c

Posted by Jeff Trawick <tr...@attglobal.net>.
André Malo wrote:
> * trawick@apache.org wrote:
> 
> 
>>  mod_log_config: Add the ability to log the id of the thread
>>  processing the request (%I).
> 
> 
> %I is already used by mod_logio...

oh, shoot :(  (not the messenger, though)

now I see that at least the doc of mod_log_config mentions that, but as 
those were the only entries not in alphabetical order I didn't see them

looks like the available chars are really:

cdEFGjJkKLMNQRSwWxyYzZ

but hey, what if we forget having a separate format for thread id and 
instead extend the process id formatting like this?

%...P           process id only              12345
%...{pid}P      process id only              12345
%...{tid}P      thread id only               14002
%...{pid+tid}P  process id and thread id     12345/14002

Is this an improvement?


Re: cvs commit: httpd-2.0/modules/loggers mod_log_config.c

Posted by André Malo <nd...@perlig.de>.
* trawick@apache.org wrote:

>   mod_log_config: Add the ability to log the id of the thread
>   processing the request (%I).

%I is already used by mod_logio...

nd
-- 
sub the($){+shift} sub answer (){ord q
        [* It is always 42! *]       }
           print the answer
# André Malo # http://pub.perlig.de/ #