From: Andrei Zmievski Date: Wed, 15 Dec 1999 17:37:05 +0000 (+0000) Subject: Added date/time stamping to PHP error log file. Idea credit goes X-Git-Tag: PRE_LIBZEND_TO_ZEND~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b68f3af50348bc58a2720e17939b1a39bc4b6c8a;p=php Added date/time stamping to PHP error log file. Idea credit goes to Joey. @ Added date/time stamping to PHP error log file. (Andrei, Joey) --- diff --git a/main/main.c b/main/main.c index cb113a4209..c7492c61d4 100644 --- a/main/main.c +++ b/main/main.c @@ -289,6 +289,9 @@ void php3_apache_putc(char c) void php3_log_err(char *log_message) { FILE *log_file; + char error_time_str[128]; + struct tm tmbuf; + time_t error_time; PLS_FETCH(); #if APACHE SLS_FETCH(); @@ -304,6 +307,9 @@ void php3_log_err(char *log_message) #endif log_file = fopen(PG(error_log), "a"); if (log_file != NULL) { + time(&error_time); + strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", localtime_r(&error_time, &tmbuf)); + fprintf(log_file, "[%s] ", error_time_str); fprintf(log_file, log_message); fprintf(log_file, "\n"); fclose(log_file);