From 7965fcc0d3e28fa4b8e35a1a55e13004faef363d Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Tue, 8 Jun 2010 16:26:39 +0000 Subject: [PATCH] Add descriptive prefix to pid and tid in the error log. Only log the tid, if the MPM is threaded. Suggested by jorton. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952724 13f79535-47bb-0310-9956-ffa450edef68 --- server/log.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/log.c b/server/log.c index 2ed087d74e..7ae287b2d8 100644 --- a/server/log.c +++ b/server/log.c @@ -628,12 +628,17 @@ static void log_error_core(const char *file, int line, int module_index, "[%s] ", priorities[level_and_mask].t_name); len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - "[%" APR_PID_T_FMT, getpid()); + "[pid %" APR_PID_T_FMT, getpid()); #if APR_HAS_THREADS { - apr_os_thread_t tid = apr_os_thread_current(); - len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - ":%pT", &tid); + int result; + + if (ap_mpm_query(AP_MPMQ_IS_THREADED, &result) == 0 + && result == AP_MPMQ_STATIC) { + apr_os_thread_t tid = apr_os_thread_current(); + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + ":tid %pT", &tid); + } } #endif errstr[len++] = ']'; -- 2.40.0