]> granicus.if.org Git - apache/commitdiff
Add descriptive prefix to pid and tid in the error log.
authorRainer Jung <rjung@apache.org>
Tue, 8 Jun 2010 16:26:39 +0000 (16:26 +0000)
committerRainer Jung <rjung@apache.org>
Tue, 8 Jun 2010 16:26:39 +0000 (16:26 +0000)
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

index 2ed087d74e2ed1c2c25a65aac71258f18ab7fc39..7ae287b2d869fa4279b115694c0845d40fa4cb42 100644 (file)
@@ -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++] = ']';