cvs: /php4 SAPI.h main.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi php4isapi.c
/php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c

From: Date: Thu, 10 Feb 2000 15:55:40 +0000
Subject: cvs: /php4 SAPI.h main.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi php4isapi.c
/php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-10028@lists.php.net to get a copy of this message
zeev Thu Feb 10 07:55:40 2000 EDT Modified files: /php4 SAPI.h main.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c Log: Move the logging mechanism to SAPI Index: php4/SAPI.h diff -u php4/SAPI.h:1.27 php4/SAPI.h:1.28 --- php4/SAPI.h:1.27 Fri Jan 28 09:24:49 2000 +++ php4/SAPI.h Thu Feb 10 07:55:09 2000 @@ -148,6 +148,7 @@ char *(*read_cookies)(SLS_D); void (*register_server_variables)(zval *track_vars_array ELS_DC SLS_DC PLS_DC); + void (*log_message)(char *message); void (*default_post_reader)(char *content_type_dup SLS_DC); }; Index: php4/main.c diff -u php4/main.c:1.192 php4/main.c:1.193 --- php4/main.c:1.192 Sat Feb 5 11:32:27 2000 +++ php4/main.c Thu Feb 10 07:55:09 2000 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.192 2000/02/05 19:32:27 thies Exp $ */ +/* $Id: main.c,v 1.193 2000/02/10 15:55:09 zeev Exp $ */ #include <stdio.h> @@ -255,9 +255,6 @@ struct tm tmbuf; time_t error_time; PLS_FETCH(); -#if APACHE - SLS_FETCH(); -#endif /* Try to use the specified logging location. */ if (PG(error_log) != NULL) { @@ -265,42 +262,25 @@ if (!strcmp(PG(error_log), "syslog")) { syslog(LOG_NOTICE, log_message); return; - } else { -#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); - return; - } -#if HAVE_SYSLOG_H } -#endif - } - /* Otherwise fall back to the default logging location. */ -#if APACHE - if (SG(server_context)) { -#if MODULE_MAGIC_NUMBER >= 19970831 - aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, log_message); -#else - log_error(log_message, ((requset_rec *) SG(server_context))->server); #endif - } else { - fprintf(stderr, log_message); - fprintf(stderr, "\n"); + 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); + return; + } } -#endif /*APACHE */ -#if CGI_BINARY - if (php_header()) { - fprintf(stderr, log_message); - fprintf(stderr, "\n"); + /* Otherwise fall back to the default logging location, if we have one */ + + if (sapi_module.log_message) { + sapi_module.log_message(log_message); } -#endif } Index: php4/sapi/aolserver/aolserver.c diff -u php4/sapi/aolserver/aolserver.c:1.30 php4/sapi/aolserver/aolserver.c:1.31 --- php4/sapi/aolserver/aolserver.c:1.30 Wed Feb 2 09:19:35 2000 +++ php4/sapi/aolserver/aolserver.c Thu Feb 10 07:55:09 2000 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.30 2000/02/02 17:19:35 andrei Exp $ */ +/* $Id: aolserver.c,v 1.31 2000/02/10 15:55:09 zeev Exp $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -206,7 +206,7 @@ NSLS_FETCH(); PUTS("<table border=5 width=600>\n"); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.30 2000/02/02 17:19:35 andrei Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.31 2000/02/10 15:55:09 zeev Exp $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -288,6 +288,7 @@ } } + /* this structure is static (as in "it does not change") */ static sapi_module_struct sapi_module = { @@ -309,6 +310,7 @@ php_ns_sapi_read_cookies, /* read Cookies */ NULL, /* register server variables */ + NULL, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES }; Index: php4/sapi/apache/mod_php4.c diff -u php4/sapi/apache/mod_php4.c:1.21 php4/sapi/apache/mod_php4.c:1.22 --- php4/sapi/apache/mod_php4.c:1.21 Tue Feb 8 10:03:19 2000 +++ php4/sapi/apache/mod_php4.c Thu Feb 10 07:55:09 2000 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.21 2000/02/08 18:03:19 andrei Exp $ */ +/* $Id: mod_php4.c,v 1.22 2000/02/10 15:55:09 zeev Exp $ */ #include "zend.h" #include "php.h" @@ -267,6 +267,23 @@ } +static void php_apache_log_message(char *message) +{ + SLS_FETCH(); + + if (SG(server_context)) { +#if MODULE_MAGIC_NUMBER >= 19970831 + aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, message); +#else + log_error(message, ((requset_rec *) SG(server_context))->server); +#endif + } else { + fprintf(stderr, message); + fprintf(stderr, "\n"); + } +} + + static sapi_module_struct sapi_module = { "Apache", /* name */ @@ -287,6 +304,7 @@ sapi_apache_read_cookies, /* read Cookies */ sapi_apache_register_server_variables, /* register server variables */ + php_apache_log_message, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES }; Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.18 php4/sapi/cgi/cgi_main.c:1.19 --- php4/sapi/cgi/cgi_main.c:1.18 Sat Jan 29 03:55:44 2000 +++ php4/sapi/cgi/cgi_main.c Thu Feb 10 07:55:09 2000 @@ -159,6 +159,15 @@ } +static void sapi_cgi_log_message(char *message) +{ + if (php_header()) { + fprintf(stderr, message); + fprintf(stderr, "\n"); + } +} + + static sapi_module_struct sapi_module = { "CGI", /* name */ @@ -178,6 +187,7 @@ sapi_cgi_read_cookies, /* read Cookies */ sapi_cgi_register_variables, /* register server variables */ + sapi_cgi_log_message, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES }; Index: php4/sapi/isapi/php4isapi.c diff -u php4/sapi/isapi/php4isapi.c:1.16 php4/sapi/isapi/php4isapi.c:1.17 --- php4/sapi/isapi/php4isapi.c:1.16 Sun Feb 6 14:14:34 2000 +++ php4/sapi/isapi/php4isapi.c Thu Feb 10 07:55:09 2000 @@ -358,6 +358,7 @@ sapi_isapi_read_cookies, /* read Cookies */ sapi_isapi_register_server_variables, /* register server variables */ + NULL, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES }; Index: php4/sapi/phttpd/phttpd.c diff -u php4/sapi/phttpd/phttpd.c:1.8 php4/sapi/phttpd/phttpd.c:1.9 --- php4/sapi/phttpd/phttpd.c:1.8 Wed Feb 2 09:19:36 2000 +++ php4/sapi/phttpd/phttpd.c Thu Feb 10 07:55:10 2000 @@ -180,6 +180,7 @@ php_phttpd_sapi_read_cookies, /* read Cookies */ NULL, /* register server variables */ + NULL, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES }; Index: php4/sapi/roxen/roxen.c diff -u php4/sapi/roxen/roxen.c:1.14 php4/sapi/roxen/roxen.c:1.15 --- php4/sapi/roxen/roxen.c:1.14 Wed Feb 2 09:19:36 2000 +++ php4/sapi/roxen/roxen.c Thu Feb 10 07:55:10 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: roxen.c,v 1.14 2000/02/02 17:19:36 andrei Exp $ */ +/* $Id: roxen.c,v 1.15 2000/02/10 15:55:10 zeev Exp $ */ #include "php.h" #ifdef HAVE_ROXEN @@ -470,7 +470,7 @@ /* char buf[512]; */ PUTS("<table border=5 width=600>\n"); - php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.14 2000/02/02 17:19:36 andrei Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.15 2000/02/10 15:55:10 zeev Exp $"); /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -534,6 +534,7 @@ php_roxen_sapi_read_cookies, /* read Cookies */ NULL, /* register server variables */ + NULL, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES Index: php4/sapi/servlet/servlet.c diff -u php4/sapi/servlet/servlet.c:1.12 php4/sapi/servlet/servlet.c:1.13 --- php4/sapi/servlet/servlet.c:1.12 Tue Feb 1 08:25:42 2000 +++ php4/sapi/servlet/servlet.c Thu Feb 10 07:55:10 2000 @@ -236,6 +236,7 @@ sapi_servlet_read_cookies, /* read Cookies */ NULL, /* register server variables */ + NULL, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES }; Index: php4/sapi/thttpd/thttpd.c diff -u php4/sapi/thttpd/thttpd.c:1.5 php4/sapi/thttpd/thttpd.c:1.6 --- php4/sapi/thttpd/thttpd.c:1.5 Fri Jan 28 09:24:53 2000 +++ php4/sapi/thttpd/thttpd.c Thu Feb 10 07:55:10 2000 @@ -119,6 +119,7 @@ sapi_thttpd_read_cookies, NULL, /* register server variables */ + NULL, /* Log message */ STANDARD_SAPI_MODULE_PROPERTIES };

« previous php.version4 (#10028) next »