From 8909a59a12817e20f500aac712d8d5717f0c8ddb Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Mon, 7 Jun 2010 12:23:26 +0000 Subject: [PATCH] Add process id and thread id (if APR has thread support) to the error log. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952201 13f79535-47bb-0310-9956-ffa450edef68 --- server/log.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/log.c b/server/log.c index d41821da52..39d6f6bf60 100644 --- a/server/log.c +++ b/server/log.c @@ -28,6 +28,7 @@ #include "apr_thread_proc.h" #include "apr_lib.h" #include "apr_signal.h" +#include "apr_portable.h" #define APR_WANT_STDIO #define APR_WANT_STRFUNC @@ -620,6 +621,18 @@ static void log_error_core(const char *file, int line, int module_index, if ((level & APLOG_STARTUP) != APLOG_STARTUP) { len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, "[%s] ", priorities[level_and_mask].t_name); + + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + "[%" 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); + } +#endif + errstr[len++] = ']'; + errstr[len++] = ' '; } if (file && level_and_mask >= APLOG_DEBUG) { -- 2.40.0