From f386967b770f772fc3fc0202f6b1bf2dc25b48ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Loyet?= Date: Sat, 29 Jan 2011 10:13:24 +0000 Subject: [PATCH] - Fixed bug #53777 (php-fpm log format now match php_error log format). --- NEWS | 1 + sapi/fpm/fpm/zlog.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index a4c15cd619..ac3e8ca7be 100644 --- a/NEWS +++ b/NEWS @@ -109,6 +109,7 @@ . Fixed bug #53527 (php-fpm --test doesn't set a valuable return value). (fat) . Enforce security in the fastcgi protocol parsing. (ef-lists at email dotde) + . Fixed bug #53777 (php-fpm log format now match php_error log format). (fat) - Readline extension: . Fixed bug #53630 (Fixed parameter handling inside readline() function). diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c index b99ad850d8..ddf552b502 100644 --- a/sapi/fpm/fpm/zlog.c +++ b/sapi/fpm/fpm/zlog.c @@ -43,8 +43,11 @@ size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /* struct tm t; size_t len; - len = strftime(timebuf, timebuf_len, "%b %d %H:%M:%S", localtime_r((const time_t *) &tv->tv_sec, &t)); - len += snprintf(timebuf + len, timebuf_len - len, ".%06d", (int) tv->tv_usec); + len = strftime(timebuf, timebuf_len, "[%d-%b-%Y %H:%M:%S", localtime_r((const time_t *) &tv->tv_sec, &t)); + if (zlog_level == ZLOG_DEBUG) { + len += snprintf(timebuf + len, timebuf_len - len, ".%06d", (int) tv->tv_usec); + } + len += snprintf(timebuf + len, timebuf_len - len, "]"); return len; } /* }}} */ @@ -87,9 +90,9 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* 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) { -- 2.40.0