httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r486656 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS docs/manual/mod/mod_dumpio.xml modules/debug/mod_dumpio.c
Date Wed, 13 Dec 2006 14:04:28 GMT
Author: jim
Date: Wed Dec 13 06:04:27 2006
New Revision: 486656

URL: http://svn.apache.org/viewvc?view=rev&rev=486656
Log:
Merge r463291 from trunk:


So I'm sitting in Rich's talk and think to myself, it's kind
of stupid that DumpIO always logs at Debug, esp when
you consider that it's likely you'll be doing so
in conjunction with SSL... One Big Log is understating
it! :)

Add DumpIOLogLevel to allow one to change the level...

Reviewed by: jim

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/manual/mod/mod_dumpio.xml
    httpd/httpd/branches/2.2.x/modules/debug/mod_dumpio.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&rev=486656&r1=486655&r2=486656
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Wed Dec 13 06:04:27 2006
@@ -1,6 +1,9 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.4
 
+  *) Allow mod_dumpio to log at other than DEBUG levels via
+     the new DumpIOLogLevel directive. [Jim Jagielski]
+
   *) rotatelogs: Improve error message for open failures.  PR 39487.
      [Joe Orton]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=486656&r1=486655&r2=486656
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Wed Dec 13 06:04:27 2006
@@ -78,17 +78,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_dumpio: Allow logging at other LogLevels via DumpIOLogLevel
-     directive.
-      Trunk version of patch:
-        http://svn.apache.org/viewvc?view=rev&revision=463291
-      2.2.x version of patch:
-        http://people.apache.org/~jim/patches/dumpio-patch.txt
-      +1: jim, wrowe, trawick (remember to tweak the "2.3.x" string in
-          mod_dumpio.xml)
-      wrowe asks: isn't it time to make LogLevel directive parsing
-                  reusable in the ap_config api?
-
    * mod_proxy_balancer: Have the find_best_worker() function
     increment the elected counter, rather than requiring each
     ind lb method to do it, isolating what each lb method

Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/mod_dumpio.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/mod_dumpio.xml?view=diff&rev=486656&r1=486655&r2=486656
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/mod/mod_dumpio.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/mod/mod_dumpio.xml Wed Dec 13 06:04:27 2006
@@ -87,4 +87,25 @@
 </usage>
 
 </directivesynopsis>
+
+<directivesynopsis>
+
+<name>DumpIOLogLevel</name>
+<description>Controls the logging level of the DumpIO output</description>
+<syntax>DumpIOLogLevel <var>level</var></syntax>
+<default>DumpIOLogLevel debug</default>
+<contextlist><context>server config</context></contextlist>
+<compatibility>DumpIOLogLevel is only available in Apache 2.2.4 and 
+later.</compatibility>
+
+<usage>
+    <p>Enable dumping of all output at a specific <directive
+    module="core">LogLevel</directive> level.</p>
+
+    <example><title>Example</title>
+      DumpIOLogLevel notice
+    </example>
+</usage>
+
+</directivesynopsis>
 </modulesynopsis>

Modified: httpd/httpd/branches/2.2.x/modules/debug/mod_dumpio.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/debug/mod_dumpio.c?view=diff&rev=486656&r1=486655&r2=486656
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/debug/mod_dumpio.c (original)
+++ httpd/httpd/branches/2.2.x/modules/debug/mod_dumpio.c Wed Dec 13 06:04:27 2006
@@ -38,6 +38,7 @@
 typedef struct dumpio_conf_t {
     int enable_input;
     int enable_output;
+    int loglevel;
 } dumpio_conf_t;
 
 /*
@@ -47,8 +48,11 @@
 static void dumpit(ap_filter_t *f, apr_bucket *b)
 {
     conn_rec *c = f->c;
+    dumpio_conf_t *ptr =
+    (dumpio_conf_t *) ap_get_module_config(c->base_server->module_config,
+                                           &dumpio_module);
 
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
+    ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
         "mod_dumpio:  %s (%s-%s): %" APR_SIZE_T_FMT " bytes",
                 f->frec->name,
                 (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
@@ -64,7 +68,7 @@
                 obuf = malloc(nbytes+1);    /* use pool? */
                 memcpy(obuf, buf, nbytes);
                 obuf[nbytes] = '\0';
-                ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
+                ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
                      "mod_dumpio:  %s (%s-%s): %s",
                      f->frec->name,
                      (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
@@ -73,7 +77,7 @@
                 free(obuf);
             }
         } else {
-            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
+            ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
                  "mod_dumpio:  %s (%s-%s): %s",
                  f->frec->name,
                  (APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
@@ -99,8 +103,11 @@
     apr_bucket *b;
     apr_status_t ret;
     conn_rec *c = f->c;
+    dumpio_conf_t *ptr =
+    (dumpio_conf_t *) ap_get_module_config(c->base_server->module_config,
+                                           &dumpio_module);
 
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
+    ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
         "mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",
          f->frec->name,
          whichmode(mode),
@@ -114,7 +121,7 @@
           dumpit(f, b);
         }
     } else {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
+        ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
         "mod_dumpio: %s - %d", f->frec->name, ret) ;
     }
 
@@ -125,8 +132,11 @@
 {
     apr_bucket *b;
     conn_rec *c = f->c;
+    dumpio_conf_t *ptr =
+    (dumpio_conf_t *) ap_get_module_config(c->base_server->module_config,
+                                           &dumpio_module);
 
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server, "mod_dumpio: %s", f->frec->name)
;
+    ap_log_error(APLOG_MARK, ptr->loglevel, 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))
{
         /*
@@ -173,6 +183,7 @@
 {
     dumpio_conf_t *ptr = apr_pcalloc(p, sizeof *ptr);
     ptr->enable_input = ptr->enable_output = 0;
+    ptr->loglevel = APLOG_DEBUG;
     return ptr;
 }
 
@@ -196,11 +207,63 @@
     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))) {
+        if (!strcasecmp(str, "emerg")) {
+            ptr->loglevel = APLOG_EMERG;
+        }
+        else if (!strcasecmp(str, "alert")) {
+            ptr->loglevel = APLOG_ALERT;
+        }
+        else if (!strcasecmp(str, "crit")) {
+            ptr->loglevel = APLOG_CRIT;
+        }
+        else if (!strcasecmp(str, "error")) {
+            ptr->loglevel = APLOG_ERR;
+        }
+        else if (!strcasecmp(str, "warn")) {
+            ptr->loglevel = APLOG_WARNING;
+        }
+        else if (!strcasecmp(str, "notice")) {
+            ptr->loglevel = APLOG_NOTICE;
+        }
+        else if (!strcasecmp(str, "info")) {
+            ptr->loglevel = APLOG_INFO;
+        }
+        else if (!strcasecmp(str, "debug")) {
+            ptr->loglevel = APLOG_DEBUG;
+        }
+        else {
+            return "DumpIOLogLevel requires level keyword: one of "
+                   "emerg/alert/crit/error/warn/notice/info/debug";
+        }
+    }
+    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 }
 };
 



Mime
View raw message