httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/loggers mod_log_config.c
Date Fri, 18 Apr 2003 19:40:11 GMT
trawick     2003/04/18 12:40:11

  Modified:    .        CHANGES
               docs/manual/mod mod_log_config.xml mod_log_config.html.en
               modules/loggers mod_log_config.c
  Log:
  change the way that thread id is specified in the log format since
  the previous implementation used a format string already taken
  by mod_logio
  
  now, an optional %P format is used instead
  
  thanks to Andre' Malo for pointing out that I chose a format string
  already used by mod_logio!
  
  Revision  Changes    Path
  1.1150    +1 -1      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1149
  retrieving revision 1.1150
  diff -u -r1.1149 -r1.1150
  --- CHANGES	18 Apr 2003 10:44:10 -0000	1.1149
  +++ CHANGES	18 Apr 2003 19:39:54 -0000	1.1150
  @@ -3,7 +3,7 @@
     [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 
  
  
  
  1.21      +5 -3      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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mod_log_config.xml	18 Apr 2003 10:44:11 -0000	1.20
  +++ mod_log_config.xml	18 Apr 2003 19:40:10 -0000	1.21
  @@ -83,9 +83,6 @@
       <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>
  @@ -112,6 +109,11 @@
   
       <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
  
  
  
  1.30      +11 -9     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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mod_log_config.html.en	18 Apr 2003 10:44:11 -0000	1.29
  +++ mod_log_config.html.en	18 Apr 2003 19:40:10 -0000	1.30
  @@ -97,27 +97,29 @@
           <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>
  
  
  
  1.103     +19 -12    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.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- mod_log_config.c	18 Apr 2003 10:44:11 -0000	1.102
  +++ mod_log_config.c	18 Apr 2003 19:40:11 -0000	1.103
  @@ -613,20 +613,28 @@
       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)
  @@ -1393,8 +1401,7 @@
           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);
  
  
  

Mime
View raw message