]> granicus.if.org Git - apache/commitdiff
* Move the error log slug higher in the trace function, so it gets
authorSander Temme <sctemme@apache.org>
Mon, 27 Nov 2006 07:29:26 +0000 (07:29 +0000)
committerSander Temme <sctemme@apache.org>
Mon, 27 Nov 2006 07:29:26 +0000 (07:29 +0000)
  executed even if the trace_add returns in the middle
* Add a direct-to-stderr path in case we don't have a server_rec to log
  for
* Remove now redundant direct-to-sterr from x_monitor callback

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@479531 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_example.c

index b16e50ef401f2ef1a8f20b246db8072570c5a34c..32a9dd09e0acd827708518ff207470ad2d62b65d 100644 (file)
@@ -387,6 +387,28 @@ static void trace_add(server_rec *s, request_rec *r, x_cfg *mconfig,
         x_subpool = p;
         trace_copy = trace;
     }
+
+    /*
+     * You *could* change the following if you wanted to see the calling
+     * sequence reported in the server's error_log, but beware - almost all of
+     * these co-routines are called for every single request, and the impact
+     * on the size (and readability) of the error_log is considerable.
+     */
+#ifndef EXAMPLE_LOG_EACH 
+#define EXAMPLE_LOG_EACH 0
+#endif
+    if (EXAMPLE_LOG_EACH) {
+        if (s != NULL) {
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example: %s", 
+                         note);
+        } else {
+            apr_file_t *out = NULL;
+            apr_file_open_stderr(&out, p);
+            apr_file_printf(out, "mod_example traced in non-loggable "
+                            "context: %s\n", note);
+        }
+    }
+    
     /*
      * If we weren't passed a configuration record, we can't figure out to
      * what location this call applies.  This only happens for co-routines
@@ -435,18 +457,6 @@ static void trace_add(server_rec *s, request_rec *r, x_cfg *mconfig,
     else {
         trace = trace_copy;
     }
-    /*
-     * You *could* change the following if you wanted to see the calling
-     * sequence reported in the server's error_log, but beware - almost all of
-     * these co-routines are called for every single request, and the impact
-     * on the size (and readability) of the error_log is considerable.
-     */
-#ifndef EXAMPLE_LOG_EACH 
-#define EXAMPLE_LOG_EACH 0
-#endif
-    if (EXAMPLE_LOG_EACH && (s != NULL)) {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example: %s", note);
-    }
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1390,12 +1400,6 @@ static int x_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
  */
 static int x_monitor(apr_pool_t *p)
 {
-    apr_file_t *out = NULL;
-
-    apr_file_open_stderr(&out, p);
-
-    apr_file_printf(out, "Example module monitor hook handler\n");
-
     trace_add(NULL, NULL, NULL, "x_monitor()");
     return DECLINED;
 }