From 7408a11c30c6d7cf0933ebbedabf9551db598bcd Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 7 Sep 2005 16:58:30 +0000 Subject: [PATCH] - improve logging format - add logging tests --- http_api.c | 2 +- tests/allowed_methods_001.phpt | 2 ++ tests/allowed_methods_001_logging.phpt | 18 ++++++++++++++++++ tests/redirect_001.phpt | 2 ++ tests/redirect_001_logging.phpt | 18 ++++++++++++++++++ tests/redirect_002.phpt | 2 ++ tests/redirect_002_logging.phpt | 18 ++++++++++++++++++ tests/redirect_003.phpt | 2 ++ tests/redirect_003_logging.phpt | 18 ++++++++++++++++++ tests/send_data_007.phpt | 2 ++ tests/send_data_007_logging.phpt | 18 ++++++++++++++++++ 11 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 tests/allowed_methods_001_logging.phpt create mode 100644 tests/redirect_001_logging.phpt create mode 100644 tests/redirect_002_logging.phpt create mode 100644 tests/redirect_003_logging.phpt create mode 100644 tests/send_data_007_logging.phpt diff --git a/http_api.c b/http_api.c index cbc5a60..8bbb34a 100644 --- a/http_api.c +++ b/http_api.c @@ -198,7 +198,7 @@ void _http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC) php_stream *log = php_stream_open_wrapper(file, "ab", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); \ \ if (log) { \ - php_stream_printf(log TSRMLS_CC, "%s [%12s] %32s <%s>%s", datetime, type, msg, SG(request_info).request_uri, PHP_EOL); \ + php_stream_printf(log TSRMLS_CC, "%s\t[%s]\t%s\t<%s>%s", datetime, type, msg, SG(request_info).request_uri, PHP_EOL); \ php_stream_close(log); \ } \ \ diff --git a/tests/allowed_methods_001.phpt b/tests/allowed_methods_001.phpt index 2f2c4e7..f0b7d9c 100644 --- a/tests/allowed_methods_001.phpt +++ b/tests/allowed_methods_001.phpt @@ -7,6 +7,8 @@ checkcgi(); ?> --FILE-- diff --git a/tests/allowed_methods_001_logging.phpt b/tests/allowed_methods_001_logging.phpt new file mode 100644 index 0000000..a9355aa --- /dev/null +++ b/tests/allowed_methods_001_logging.phpt @@ -0,0 +1,18 @@ +--TEST-- +logging allowed methods +--SKIPIF-- +include 'skip.inc'; +checkcgi(); +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [405-ALLOWED] Allow: POST <%s> +Done diff --git a/tests/redirect_001.phpt b/tests/redirect_001.phpt index de6795f..6961579 100644 --- a/tests/redirect_001.phpt +++ b/tests/redirect_001.phpt @@ -7,6 +7,8 @@ checkcgi(); ?> --FILE-- 1, 'b' => 2)); ?> --EXPECTF-- diff --git a/tests/redirect_001_logging.phpt b/tests/redirect_001_logging.phpt new file mode 100644 index 0000000..5237c1c --- /dev/null +++ b/tests/redirect_001_logging.phpt @@ -0,0 +1,18 @@ +--TEST-- +logging redirects +--SKIPIF-- +include 'skip.inc'; +checkcgi(); +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s> +Done diff --git a/tests/redirect_002.phpt b/tests/redirect_002.phpt index da77696..9add4a0 100644 --- a/tests/redirect_002.phpt +++ b/tests/redirect_002.phpt @@ -7,6 +7,8 @@ checkcgi(); ?> --FILE-- 1), true); ?> diff --git a/tests/redirect_002_logging.phpt b/tests/redirect_002_logging.phpt new file mode 100644 index 0000000..5237c1c --- /dev/null +++ b/tests/redirect_002_logging.phpt @@ -0,0 +1,18 @@ +--TEST-- +logging redirects +--SKIPIF-- +include 'skip.inc'; +checkcgi(); +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s> +Done diff --git a/tests/redirect_003.phpt b/tests/redirect_003.phpt index 2f893c3..cd9fb4e 100644 --- a/tests/redirect_003.phpt +++ b/tests/redirect_003.phpt @@ -7,6 +7,8 @@ checkcgi(); ?> --FILE-- --EXPECTF-- diff --git a/tests/redirect_003_logging.phpt b/tests/redirect_003_logging.phpt new file mode 100644 index 0000000..2296e63 --- /dev/null +++ b/tests/redirect_003_logging.phpt @@ -0,0 +1,18 @@ +--TEST-- +logging redirects +--SKIPIF-- +include 'skip.inc'; +checkcgi(); +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [301-REDIRECT] Location: http%s <%s> +Done diff --git a/tests/send_data_007.phpt b/tests/send_data_007.phpt index f7b60f0..f6d6058 100644 --- a/tests/send_data_007.phpt +++ b/tests/send_data_007.phpt @@ -9,6 +9,8 @@ checkcgi(); HTTP_IF_NONE_MATCH="0bee89b07a248e27c83fc3d5951213c1" --FILE-- diff --git a/tests/send_data_007_logging.phpt b/tests/send_data_007_logging.phpt new file mode 100644 index 0000000..4395fca --- /dev/null +++ b/tests/send_data_007_logging.phpt @@ -0,0 +1,18 @@ +--TEST-- +logging caching +--SKIPIF-- +include 'skip.inc'; +checkcgi(); +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [304-CACHE] ETag: "%s" <%s> +Done -- 2.30.2