]> granicus.if.org Git - php/commitdiff
Added date/time stamping to PHP error log file. Idea credit goes
authorAndrei Zmievski <andrei@php.net>
Wed, 15 Dec 1999 17:37:05 +0000 (17:37 +0000)
committerAndrei Zmievski <andrei@php.net>
Wed, 15 Dec 1999 17:37:05 +0000 (17:37 +0000)
to Joey.
@ Added date/time stamping to PHP error log file. (Andrei, Joey)

main/main.c

index cb113a42095d431bcc7002be50ee62c8c86dd501..c7492c61d41e01b11551098c2d2d97e5520c54a2 100644 (file)
@@ -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);