From: Stefan Fritsch Date: Sun, 6 Jun 2010 17:08:57 +0000 (+0000) Subject: Replace DumpIOLogLevel with trace log levels X-Git-Tag: 2.3.6~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f1e26cc211c223175ef0b10959fcfcd3dde5af6;p=apache Replace DumpIOLogLevel with trace log levels git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951902 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_dumpio.xml b/docs/manual/mod/mod_dumpio.xml index d3bbd93488..9d14c8eca3 100644 --- a/docs/manual/mod/mod_dumpio.xml +++ b/docs/manual/mod/mod_dumpio.xml @@ -43,9 +43,16 @@
Enabling dumpio Support -

To enable the module, it should be compiled and - loaded in to your running Apache configuration. Logging - can then be enabled or disabled via the below directives.

+

To enable the module, it should be compiled and loaded + in to your running Apache configuration. Logging can then + be enabled or disabled seperately for input and output via + the below directives. Additionally, mod_dumpio + needs to be configured to LogLevel trace7: +

+ + LogLevel dumpio:trace7 +
@@ -88,28 +95,4 @@ later. - - -DumpIOLogLevel -Controls the logging level of the DumpIO output -DumpIOLogLevel level -DumpIOLogLevel debug -server config -DumpIOLogLevel is only available in Apache 2.2.4 and -later. - - -

Enable dumping of all output at a specific LogLevel level.

- - Example - DumpIOLogLevel notice - - - CompatibilityPrior to 2.2.4 mod_dumpio - would only dump to the log when LogLevel was set to debug -
- -
diff --git a/modules/debugging/mod_dumpio.c b/modules/debugging/mod_dumpio.c index d8d8c2e63d..901e34085f 100644 --- a/modules/debugging/mod_dumpio.c +++ b/modules/debugging/mod_dumpio.c @@ -39,7 +39,6 @@ module AP_MODULE_DECLARE_DATA dumpio_module ; typedef struct dumpio_conf_t { int enable_input; int enable_output; - int loglevel; } dumpio_conf_t; /* consider up to 80 additional characters, and factor the longest @@ -56,7 +55,7 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr) { conn_rec *c = f->c; - ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s (%s-%s): %" APR_SIZE_T_FMT " bytes", f->frec->name, (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data", @@ -86,7 +85,7 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr) memcpy(xlatebuf, buf, logbytes); ap_xlate_proto_from_ascii(xlatebuf, logbytes); xlatebuf[logbytes] = '\0'; - ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s (%s-%s): %s", f->frec->name, (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data", b->type->name, xlatebuf); @@ -99,14 +98,14 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr) * within ap_log_error, and introduce new vformatter %-escapes * for escaping text, and for binary text (fixed len strings). */ - ap_log_error(APLOG_MARK | APLOG_NOERRNO, ptr->loglevel, 0, c->base_server, + ap_log_error(APLOG_MARK | APLOG_NOERRNO, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s (%s-%s): %.*s", f->frec->name, (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data", b->type->name, (int)logbytes, buf); #endif } } else { - ap_log_error(APLOG_MARK, ptr->loglevel, rv, c->base_server, + ap_log_error(APLOG_MARK, APLOG_TRACE7, rv, c->base_server, "mod_dumpio: %s (%s-%s): %s", f->frec->name, (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data", b->type->name, "error reading data"); @@ -132,7 +131,7 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb, conn_rec *c = f->c; dumpio_conf_t *ptr = f->ctx; - ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes", f->frec->name, whichmode(mode), @@ -146,7 +145,7 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb, dumpit(f, b, ptr); } } else { - ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s - %d", f->frec->name, ret) ; } @@ -159,7 +158,7 @@ static int dumpio_output_filter (ap_filter_t *f, apr_bucket_brigade *bb) conn_rec *c = f->c; dumpio_conf_t *ptr = f->ctx; - ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server, "mod_dumpio: %s", f->frec->name) ; + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s", f->frec->name) ; for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) { /* @@ -207,7 +206,6 @@ static void *dumpio_create_sconfig(apr_pool_t *p, server_rec *s) { dumpio_conf_t *ptr = apr_pcalloc(p, sizeof *ptr); ptr->enable_input = ptr->enable_output = 0; - ptr->loglevel = APLOG_DEBUG; return ptr; } @@ -231,38 +229,11 @@ static const char *dumpio_enable_output(cmd_parms *cmd, void *dummy, int arg) return NULL; } -static const char *set_loglevel(cmd_parms *cmd, void *dummy, const char *arg) -{ - char *str; - dumpio_conf_t *ptr = - (dumpio_conf_t *) ap_get_module_config(cmd->server->module_config, - &dumpio_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if ((str = ap_getword_conf(cmd->pool, &arg))) { - err = ap_parse_log_level(str, &ptr->loglevel); - if (err != NULL) - return apr_psprintf(cmd->pool, "DumpIOLogLevel: %s", err); - } - else { - return "DumpIOLogLevel requires level keyword"; - } - - return NULL; -} - static const command_rec dumpio_cmds[] = { AP_INIT_FLAG("DumpIOInput", dumpio_enable_input, NULL, RSRC_CONF, "Enable I/O Dump on Input Data"), AP_INIT_FLAG("DumpIOOutput", dumpio_enable_output, NULL, RSRC_CONF, "Enable I/O Dump on Output Data"), - AP_INIT_TAKE1("DumpIOLogLevel", set_loglevel, NULL, RSRC_CONF, - "Level at which DumpIO info is logged"), { NULL } };