com php-src: change error log date format: main/main.c

From: Date: Thu, 12 Dec 2013 08:47:41 +0000
Subject: com php-src: change error log date format: main/main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-76648@lists.php.net to get a copy of this message
Commit: d3d5222989409901449a42dee78cbe1549702c8d Author: Antony Dovgal <tony@daylessday.org> Sat, 31 Dec 2011 00:50:53 +0400 Committer: Antony Dovgal <tony2001@php.net> Thu, 12 Dec 2013 12:47:41 +0400 Parents: ed35a625564bf88359238adb4f92264efb9aa2a4 Branches: badoo-5..5_mysqlnd Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d3d5222989409901449a42dee78cbe1549702c8d Log: change error log date format Changed paths: M main/main.c Diff: diff --git a/main/main.c b/main/main.c index e1d8570..2f23935 100644 --- a/main/main.c +++ b/main/main.c @@ -641,27 +641,21 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, error_log_mode); umask(old_umask); if (fd != -1) { + struct tm tmbuf; char *tmp; int len; - char *error_time_str; + char error_time_str[128]; + static const char *months[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; time(&error_time); -#ifdef ZTS - if (!php_during_module_startup()) { - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); - } else { - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC); - } -#else - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); -#endif - len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL); + php_localtime_r(&error_time, &tmbuf); + strftime(error_time_str, sizeof(error_time_str), "%Y %H:%M:%S", &tmbuf); + len = spprintf(&tmp, 0, "[%02d-%s-%s] %s%s", tmbuf.tm_mday, months[tmbuf.tm_mon], error_time_str, log_message, PHP_EOL); #ifdef PHP_WIN32 php_flock(fd, 2); #endif php_ignore_value(write(fd, tmp, len)); efree(tmp); - efree(error_time_str); close(fd); PG(in_error_log) = 0; return;

« previous php.cvs (#76648) next »