Author: rjung
Date: Wed Aug 23 12:17:14 2006
New Revision: 434128

URL: http://svn.apache.org/viewvc?rev=434128&view=rev
Log:
Add another server hook add_log_items to be able to return textual
result tokens to include in server logging.

We will use this in the load balancer to return names of used balanced 
orkers and their state. It would be nice, if the other (non Apache) servers
also had hash like structures which could be filled by this hook.

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
    tomcat/connectors/trunk/jk/native/common/jk_service.h
    tomcat/connectors/trunk/jk/native/common/jk_util.c

Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?rev=434128&r1=434127&r2=434128&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Wed Aug 23 12:17:14 
2006
@@ -202,6 +202,12 @@
                              void *b, unsigned l, unsigned *a);
 
 static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned l);
+
+static void JK_METHOD ws_add_log_items(jk_ws_service_t *s,
+                                       const char *const *log_names,
+                                       const char *const *log_values,
+                                       unsigned num_of_log_items);
+
 /* srevilak - new function prototypes */
 static void jk_server_cleanup(void *data);
 static void jk_generic_cleanup(server_rec * s);
@@ -381,6 +387,22 @@
     return JK_FALSE;
 }
 
+static void JK_METHOD ws_add_log_items(jk_ws_service_t *s,
+                                       const char *const *log_names,
+                                       const char *const *log_values,
+                                       unsigned num_of_log_items)
+{
+    unsigned h;
+    apache_private_data_t *p = s->ws_private;
+    request_rec *r = p->r;
+
+    for (h = 0; h < num_of_log_items; h++) {
+        if (log_names[h] && log_values[h]) {
+            ap_table_setn(r->notes, log_names[h], log_values[h]);
+        }
+    }
+}
+
 /* ====================================================================== */
 /* Utility functions                                                      */
 /* ====================================================================== */
@@ -455,6 +477,7 @@
     s->read = ws_read;
     s->write = ws_write;
     s->flush = ws_flush;
+    s->add_log_items = ws_add_log_items;
 
     /* Clear RECO status */
     s->reco_status = RECO_NONE;
@@ -2119,7 +2142,7 @@
 for (i = 0; i < jk_map_size(conf->automount); i++)
 {
             char *name = jk_map_name_at(conf->automount, i);
-                       jk_log(conf->log, JK_LOG_DEBUG, "worker = %s and 
virtualhost = %s", name, map_get_string(conf->automount, name, NULL));
+            jk_log(conf->log, JK_LOG_DEBUG, "worker = %s and virtualhost = 
%s", name, map_get_string(conf->automount, name, NULL));
 }
 }
 */

Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=434128&r1=434127&r2=434128&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Wed Aug 23 12:17:14 
2006
@@ -220,6 +220,10 @@
 
 static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned l);
 
+static void JK_METHOD ws_add_log_items(jk_ws_service_t *s,
+                                       const char *const *log_names,
+                                       const char *const *log_values,
+                                       unsigned num_of_log_items);
 
 /* ========================================================================= */
 /* JK Service step callbacks                                                 */
@@ -425,6 +429,22 @@
     return JK_FALSE;
 }
 
+static void JK_METHOD ws_add_log_items(jk_ws_service_t *s,
+                                       const char *const *log_names,
+                                       const char *const *log_values,
+                                       unsigned num_of_log_items)
+{
+    unsigned h;
+    apache_private_data_t *p = s->ws_private;
+    request_rec *r = p->r;
+
+    for (h = 0; h < num_of_log_items; h++) {
+        if (log_names[h] && log_values[h]) {
+            apr_table_setn(r->notes, log_names[h], log_values[h]);
+        }
+    }
+}
+
 /* ========================================================================= */
 /* Utility functions                                                         */
 /* ========================================================================= */
@@ -482,6 +502,7 @@
     s->read = ws_read;
     s->write = ws_write;
     s->flush = ws_flush;
+    s->add_log_items = ws_add_log_items;
 
     /* Clear RECO status */
     s->reco_status = RECO_NONE;

Modified: tomcat/connectors/trunk/jk/native/common/jk_service.h
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_service.h?rev=434128&r1=434127&r2=434128&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_service.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_service.h Wed Aug 23 12:17:14 
2006
@@ -254,6 +254,14 @@
      * Flush a chunk of response data back to the browser.
      */
     void (JK_METHOD * flush) (jk_ws_service_t *s);
+
+    /*
+     * Add more data to log facilities.
+     */
+    void (JK_METHOD * add_log_items) (jk_ws_service_t *s,
+                                      const char *const *log_names,
+                                      const char *const *log_values,
+                                      unsigned num_of_items);
 };
 
 /*

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=434128&r1=434127&r2=434128&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Wed Aug 23 12:17:14 2006
@@ -1311,6 +1311,7 @@
     s->num_attributes = 0;
     s->jvm_route = NULL;
     s->retries = JK_RETRIES;
+    s->add_log_items = NULL;
 }
 
 #ifdef _MT_CODE_PTHREAD



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to