On Sat, Aug 27, 2005 at 11:12:24AM -0400, Jeff Trawick wrote:
> %{tid}P gets you thread id in decimal now.
> %{hextid}P would show it in hex using relatively new apr_sprintf()
> format, added in 1.2.0.

Seems fine except that it introduces a softish dependency on apr >= 
1.2.0 which is not enforced by configure (which allows use of any apr 
1.x).

> Index: modules/loggers/mod_log_config.c
> ===================================================================
> --- modules/loggers/mod_log_config.c  (revision 240100)
> +++ modules/loggers/mod_log_config.c  (working copy)
> @@ -650,13 +650,15 @@
>      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,
> +                            *a == 'h' ? "%pt" : "%pT",
> +                            &tid);
>      }
>      /* bogus format */
>      return a;


Reply via email to