Skip to content

Commit 0e851fb

Browse files
author
fat
committed
Remove timestamp in logs written by children process
git-svn-id: http://svn.php.net/repository/php/php-src/trunk@312256 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 93c4e24 commit 0e851fb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sapi/fpm/fpm/zlog.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <errno.h>
1414

1515
#include "zlog.h"
16+
#include "fpm.h"
1617

1718
#define MAX_LINE_LENGTH 1024
1819

@@ -47,7 +48,7 @@ size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /*
4748
if (zlog_level == ZLOG_DEBUG) {
4849
len += snprintf(timebuf + len, timebuf_len - len, ".%06d", (int) tv->tv_usec);
4950
}
50-
len += snprintf(timebuf + len, timebuf_len - len, "]");
51+
len += snprintf(timebuf + len, timebuf_len - len, "] ");
5152
return len;
5253
}
5354
/* }}} */
@@ -78,7 +79,7 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /*
7879
char buf[MAX_LINE_LENGTH];
7980
const size_t buf_size = MAX_LINE_LENGTH;
8081
va_list args;
81-
size_t len;
82+
size_t len = 0;
8283
int truncated = 0;
8384
int saved_errno;
8485

@@ -87,12 +88,14 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /*
8788
}
8889

8990
saved_errno = errno;
90-
gettimeofday(&tv, 0);
91-
len = zlog_print_time(&tv, buf, buf_size);
91+
if (!fpm_globals.is_child) {
92+
gettimeofday(&tv, 0);
93+
len = zlog_print_time(&tv, buf, buf_size);
94+
}
9295
if (zlog_level == ZLOG_DEBUG) {
93-
len += snprintf(buf + len, buf_size - len, " %s: pid %d, %s(), line %d: ", level_names[flags & ZLOG_LEVEL_MASK], getpid(), function, line);
96+
len += snprintf(buf + len, buf_size - len, "%s: pid %d, %s(), line %d: ", level_names[flags & ZLOG_LEVEL_MASK], getpid(), function, line);
9497
} else {
95-
len += snprintf(buf + len, buf_size - len, " %s: ", level_names[flags & ZLOG_LEVEL_MASK]);
98+
len += snprintf(buf + len, buf_size - len, "%s: ", level_names[flags & ZLOG_LEVEL_MASK]);
9699
}
97100

98101
if (len > buf_size - 1) {

0 commit comments

Comments
 (0)