From: Jérôme Loyet Date: Sat, 18 Jun 2011 15:33:07 +0000 (+0000) Subject: Remove timestamp in logs written by children process X-Git-Tag: php-5.3.7RC2~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22be55e6da624ee18f9ab4085faeaa9c83b101e9;p=php Remove timestamp in logs written by children process --- diff --git a/NEWS b/NEWS index 9d1e6775de..ed44b3b922 100644 --- a/NEWS +++ b/NEWS @@ -173,6 +173,7 @@ PHP NEWS - PHP-FPM SAPI: . Added xml format to the status page. (fat) + . Remove timestamp in logs written by children processes. (fat) - Reflection extension: . Fixed bug #54347 (reflection_extension does not lowercase module function diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c index ddf552b502..fe62fd5ce6 100644 --- a/sapi/fpm/fpm/zlog.c +++ b/sapi/fpm/fpm/zlog.c @@ -13,6 +13,7 @@ #include #include "zlog.h" +#include "fpm.h" #define MAX_LINE_LENGTH 1024 @@ -47,7 +48,7 @@ size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /* if (zlog_level == ZLOG_DEBUG) { len += snprintf(timebuf + len, timebuf_len - len, ".%06d", (int) tv->tv_usec); } - len += snprintf(timebuf + len, timebuf_len - len, "]"); + len += snprintf(timebuf + len, timebuf_len - len, "] "); return len; } /* }}} */ @@ -78,7 +79,7 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* char buf[MAX_LINE_LENGTH]; const size_t buf_size = MAX_LINE_LENGTH; va_list args; - size_t len; + size_t len = 0; int truncated = 0; int saved_errno; @@ -87,12 +88,14 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* } saved_errno = errno; - gettimeofday(&tv, 0); - len = zlog_print_time(&tv, buf, buf_size); + if (!fpm_globals.is_child) { + gettimeofday(&tv, 0); + len = zlog_print_time(&tv, buf, buf_size); + } if (zlog_level == ZLOG_DEBUG) { - len += snprintf(buf + len, buf_size - len, " %s: pid %d, %s(), line %d: ", level_names[flags & ZLOG_LEVEL_MASK], getpid(), function, line); + len += snprintf(buf + len, buf_size - len, "%s: pid %d, %s(), line %d: ", level_names[flags & ZLOG_LEVEL_MASK], getpid(), function, line); } else { - len += snprintf(buf + len, buf_size - len, " %s: ", level_names[flags & ZLOG_LEVEL_MASK]); + len += snprintf(buf + len, buf_size - len, "%s: ", level_names[flags & ZLOG_LEVEL_MASK]); } if (len > buf_size - 1) {