fat                                      Sat, 18 Jun 2011 15:33:07 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312256

Log:
Remove timestamp in logs written by children process

Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c
    U   php/php-src/branches/PHP_5_4/sapi/fpm/fpm/zlog.c
    U   php/php-src/trunk/sapi/fpm/fpm/zlog.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-06-18 13:12:39 UTC (rev 312255)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-06-18 15:33:07 UTC (rev 312256)
@@ -173,6 +173,7 @@

 - 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

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c    2011-06-18 13:12:39 UTC 
(rev 312255)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c    2011-06-18 15:33:07 UTC 
(rev 312256)
@@ -13,6 +13,7 @@
 #include <errno.h>

 #include "zlog.h"
+#include "fpm.h"

 #define MAX_LINE_LENGTH 1024

@@ -47,7 +48,7 @@
        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 @@
        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 @@
        }

        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) {

Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/zlog.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/zlog.c    2011-06-18 13:12:39 UTC 
(rev 312255)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/zlog.c    2011-06-18 15:33:07 UTC 
(rev 312256)
@@ -13,6 +13,7 @@
 #include <errno.h>

 #include "zlog.h"
+#include "fpm.h"

 #define MAX_LINE_LENGTH 1024

@@ -47,7 +48,7 @@
        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 @@
        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 @@
        }

        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) {

Modified: php/php-src/trunk/sapi/fpm/fpm/zlog.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/zlog.c       2011-06-18 13:12:39 UTC (rev 
312255)
+++ php/php-src/trunk/sapi/fpm/fpm/zlog.c       2011-06-18 15:33:07 UTC (rev 
312256)
@@ -13,6 +13,7 @@
 #include <errno.h>

 #include "zlog.h"
+#include "fpm.h"

 #define MAX_LINE_LENGTH 1024

@@ -47,7 +48,7 @@
        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 @@
        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 @@
        }

        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) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to