You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/12/17 08:17:09 UTC

cvs commit: jakarta-tomcat-connectors/jk/native2/server/apache2 jk_logger_apache2.c jk_service_apache2.c mod_jk.c

costin      01/12/16 23:17:09

  Modified:    jk/native2 CHANGES.html
               jk/native2/common jk_ajp14_worker.c jk_channel_socket.c
                        jk_handler_response.c jk_msg_ajp.c
                        jk_serialize_ajp.c jk_workerEnv.c
               jk/native2/server/apache2 jk_logger_apache2.c
                        jk_service_apache2.c mod_jk.c
  Log:
  Few fixes to get everything to work as before.
  Log level needs to be set on the apache logger.
  The post message is sent only if we have body ( it caused a strange behavior since
  the receiver didn't expect it )
  Some log messages are a big shorter, easier to read and some trivial info has been removed.
  
  There are few printf() remaining in mod_jk, as I try to figure how to get the location
  and virtual host out of <VirtualHost><Location>JkWorker foo </>. Probably we can do a
  small workaround and compute it at the first request ( and config the detailed mappings
  at that time too, which is nice for large sites ) or we can add more config directives,
  but it would be nice to avoid duplicating the info.
  
  Revision  Changes    Path
  1.3       +1 -1      jakarta-tomcat-connectors/jk/native2/CHANGES.html
  
  Index: CHANGES.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/CHANGES.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CHANGES.html	2001/12/16 23:44:31	1.2
  +++ CHANGES.html	2001/12/17 07:17:08	1.3
  @@ -56,7 +56,7 @@
   The same pattern is used no consistently in all methods.
   
   <li>(not completed) Error handling. The env parameter will provide a mechanism to
  -pass error information up the stack ( eventually a stack trace ). It'll also 
  +pass error information up the stack ( eventually a stack trace ). It'll also   
   provide per/thread storage and a temp pool.
   
   </ul>
  
  
  
  1.11      +14 -18    jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c
  
  Index: jk_ajp14_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_ajp14_worker.c	2001/12/16 23:18:11	1.10
  +++ jk_ajp14_worker.c	2001/12/17 07:17:08	1.11
  @@ -278,6 +278,7 @@
   {
       int err;
       int attempt;
  +    int hasPost=JK_FALSE;
   
       if( ( e== NULL ) 
   	|| ( s == NULL )
  @@ -328,9 +329,11 @@
                             "ajp14.service() Error receiving initial post data\n");
               return JK_FALSE;
           }
  +        hasPost=JK_TRUE;
       }
           
  -    env->l->jkLog(env, env->l, JK_LOG_DEBUG, "ajp14.service() %s\n", e->worker->name);
  +    env->l->jkLog(env, env->l, JK_LOG_INFO,
  +                  "ajp14.service() %s\n", e->worker->name);
   
       /*
        * Try to send the request on a valid endpoint. If one endpoint
  @@ -342,6 +345,7 @@
       for(attempt = 0 ; attempt < e->worker->connect_retry_attempts ; attempt++) {
           jk_channel_t *channel=e->worker->channel;
   
  +        /* e->request->dump(env, e->request, "Before sending "); */
           err=e->request->send( env, e->request, e);
   
   	if (err==JK_TRUE ) {
  @@ -381,8 +385,9 @@
       /* We should have a channel now, send the post data */
       *is_recoverable_error = JK_TRUE;
       e->recoverable = JK_TRUE;
  -    
  -    err= e->post->send( env, e->post, e );
  +
  +    if( hasPost==JK_TRUE)
  +        err= e->post->send( env, e->post, e );
   
       err = e->worker->workerEnv->processCallbacks(env, e->worker->workerEnv,
                                                    e, s);
  @@ -398,10 +403,12 @@
                         err);
           return JK_FALSE;
       }
  -    
  -    env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                  "ajp14.service() ajpGetReply recoverable error %d\n", err);
   
  +    if( err != JK_TRUE ) {
  +        env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                      "ajp14.service() ajpGetReply recoverable error %d\n", err);
  +    }
  +    
       return err;
   }
   
  @@ -413,25 +420,14 @@
       
       w= e->worker;
   
  -    env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                  "ajp14.done() before reset pool %p\n",
  -                  e->cPool );
       if( e->cPool != NULL ) 
           e->cPool->reset(env, e->cPool);
  -    env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                  "ajp14.done() after reset pool %p\n",
  -                  e->cPool );
  -
       if (w->endpointCache != NULL ) {
           int err=0;
  -        env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                      "ajp14.done() before return to pool %s\n",
  -                      w->name );
  -        
           err=w->endpointCache->put( env, w->endpointCache, e );
           if( err==JK_TRUE ) {
               env->l->jkLog(env, env->l, JK_LOG_INFO, "ajp14.done() return to pool %s\n",
  -                     w->name );
  +                          w->name );
               return JK_TRUE;
           }
       }
  
  
  
  1.11      +7 -7      jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c
  
  Index: jk_channel_socket.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_channel_socket.c	2001/12/16 23:18:11	1.10
  +++ jk_channel_socket.c	2001/12/17 07:17:08	1.11
  @@ -435,13 +435,13 @@
       _this->_privatePtr= (jk_channel_socket_private_t *)
   	pool->calloc( env, pool, sizeof( jk_channel_socket_private_t));
   
  -    _this->recv= &jk_channel_socket_recv; 
  -    _this->send= &jk_channel_socket_send; 
  -    _this->init= &jk_channel_socket_init; 
  -    _this->open= &jk_channel_socket_open; 
  -    _this->close= &jk_channel_socket_close; 
  -    _this->getProperty= &jk_channel_socket_getProperty; 
  -    _this->setProperty= &jk_channel_socket_setProperty; 
  +    _this->recv= jk_channel_socket_recv; 
  +    _this->send= jk_channel_socket_send; 
  +    _this->init= jk_channel_socket_init; 
  +    _this->open= jk_channel_socket_open; 
  +    _this->close= jk_channel_socket_close; 
  +    _this->getProperty= jk_channel_socket_getProperty; 
  +    _this->setProperty= jk_channel_socket_setProperty; 
   
       _this->supportedProperties=( char ** )pool->alloc( env, pool,
                                                          4 * sizeof( char * ));
  
  
  
  1.11      +3 -3      jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c
  
  Index: jk_handler_response.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_handler_response.c	2001/12/16 23:18:11	1.10
  +++ jk_handler_response.c	2001/12/17 07:17:08	1.11
  @@ -166,9 +166,9 @@
           
           jk_xlate_from_ascii(valueS, strlen(valueS));
           
  -        env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                      "ajp_unmarshal_response: Header[%d] [%s] = [%s]\n", 
  -                      i, nameS, valueS);
  +        /* env->l->jkLog(env, env->l, JK_LOG_INFO, */
  +        /*               "handler.response() Header[%d] [%s] = [%s]\n",  */
  +        /*               i, nameS, valueS); */
   
           /* Do we want this ? Preserve the headers, maybe someone will
            need them. Alternative is to use a different buffer every time,
  
  
  
  1.4       +25 -14    jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c
  
  Index: jk_msg_ajp.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_msg_ajp.c	2001/12/16 23:29:55	1.3
  +++ jk_msg_ajp.c	2001/12/17 07:17:08	1.4
  @@ -60,7 +60,7 @@
    * Author:      Costin Manolache
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    * Author:      Henri Gomez <hg...@slib.fr>                               *
  - * Version:     $Revision: 1.3 $                                           *
  + * Version:     $Revision: 1.4 $                                           *
    ***************************************************************************/
   
   #include "jk_pool.h"
  @@ -82,26 +82,35 @@
   {
       int i=0;
       env->l->jkLog( env, env->l, JK_LOG_INFO,
  -                "%s pos=%d len=%d max=%d "
  -                "%x %x %x %x - %x %x %x %x -"
  -                "%x %x %x %x - %x %x %x %x\n",
  -                err, _this->pos, _this->len, _this->maxlen,  
  +                   "%s pos=%d len=%d max=%d ",
  +                err, _this->pos, _this->len, _this->maxlen );
  +    
  +    env->l->jkLog( env, env->l, JK_LOG_INFO,
  +                "%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x\n", 
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++]);
  -    
  -    i = _this->pos - 4;
  -    if(i < 0) {
  -        i=0;
  -    }
  -    
  +    i-=16;
  +    env->l->jkLog( env, env->l, JK_LOG_INFO,
  +                "%c  %c  %c  %c: %c  %c  %c  %c: %c  %c  %c  %c: %c  %c  %c  %c\n", 
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++]);
       env->l->jkLog( env, env->l, JK_LOG_INFO,
  -                "       %x %x %x %x - %x %x %x %x --- %x %x %x %x - %x %x %x %x\n", 
  +                "%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x\n", 
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
                   _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++]);
  +    i-=16;
  +    env->l->jkLog( env, env->l, JK_LOG_INFO,
  +                "%c  %c  %c  %c: %c  %c  %c  %c: %c  %c  %c  %c: %c  %c  %c  %c\n", 
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++],
  +                _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++]);
   }
   
    
  @@ -180,7 +189,7 @@
       int len;
   
       if(!param) {
  -        msg->appendInt( env, msg, 0xFFFF );
  +         msg->appendInt( env, msg, 0xFFFF );
           return 0; 
       }
   
  @@ -334,7 +343,9 @@
       jk_msg_ajp_end(env, msg);
   
       /* jk_msg_ajp_dump(l, JK_LOG_DEBUG, "sending to ajp13", msg); */
  -
  +    env->l->jkLog( env, env->l, JK_LOG_INFO,
  +                   "msgAjp.send() %d\n", msg->len );
  +    
       err=channel->send( env, channel, ae, 
                          msg->buf, msg->len );
       
  
  
  
  1.4       +3 -4      jakarta-tomcat-connectors/jk/native2/common/jk_serialize_ajp.c
  
  Index: jk_serialize_ajp.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_serialize_ajp.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_serialize_ajp.c	2001/12/16 23:29:55	1.3
  +++ jk_serialize_ajp.c	2001/12/17 07:17:08	1.4
  @@ -176,9 +176,6 @@
       int i;
       int headerCount;
   
  -    env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                  "Into ajp_marshal_into_msgb\n");
  -
       if (!jk_requtil_getMethodId(env, s->method, &method)) { 
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
                         "Error ajp_marshal_into_msgb - No such method %s\n",
  @@ -329,7 +326,9 @@
       }
       
       env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                  "handle.request() request serialized\n");
  +                  "serialize.request() serialized %s\n", s->req_uri);
  +
  +    /*  msg->dump( env, msg, "Dump: " ); */
       return JK_TRUE;
   }
   
  
  
  
  1.11      +4 -2      jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c
  
  Index: jk_workerEnv.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_workerEnv.c	2001/12/16 23:29:55	1.10
  +++ jk_workerEnv.c	2001/12/17 07:17:08	1.11
  @@ -59,7 +59,7 @@
    * Description: Workers controller                                         *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    * Author:      Henri Gomez <hg...@slib.fr>                               *
  - * Version:     $Revision: 1.10 $                                           *
  + * Version:     $Revision: 1.11 $                                           *
    ***************************************************************************/
   
   #include "jk_workerEnv.h" 
  @@ -296,6 +296,8 @@
               /* we just can't recover, unset recover flag */
               return JK_FALSE;
           }
  +
  +        /* e->reply->dump(env, e->reply, "Received ");  */
           
           code = (int)e->reply->getByte(env, e->reply);
           if( code < maxHandler ) {
  @@ -309,7 +311,7 @@
               return JK_FALSE;
           }
           
  -        env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +        env->l->jkLog(env, env->l, JK_LOG_INFO,
                         "ajp14.dispath() Calling %d %s\n", handler->messageId,
                         handler->name);
           
  
  
  
  1.11      +1 -1      jakarta-tomcat-connectors/jk/native2/server/apache2/jk_logger_apache2.c
  
  Index: jk_logger_apache2.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/jk_logger_apache2.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_logger_apache2.c	2001/12/16 23:36:58	1.10
  +++ jk_logger_apache2.c	2001/12/17 07:17:08	1.11
  @@ -180,7 +180,7 @@
       if(l==NULL ) {
           return JK_FALSE;
       }
  -
  +    
       l->log = jk_logger_apache2_log;
       l->logger_private = NULL;
       l->open =jk_logger_apache2_open;
  
  
  
  1.5       +5 -5      jakarta-tomcat-connectors/jk/native2/server/apache2/jk_service_apache2.c
  
  Index: jk_service_apache2.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/jk_service_apache2.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_service_apache2.c	2001/12/16 23:36:58	1.4
  +++ jk_service_apache2.c	2001/12/17 07:17:08	1.5
  @@ -59,7 +59,7 @@
    * Description: Apache 2 plugin for Jakarta/Tomcat                         
    * Author:      Gal Shachor <sh...@il.ibm.com>                           
    *                 Henri Gomez <hg...@slib.fr>                            
  - * Version:     $Revision: 1.4 $                                           
  + * Version:     $Revision: 1.5 $                                           
    */
   
   #include "apu_compat.h"
  @@ -214,8 +214,8 @@
               char *bb=(char *)b;
               
               if(!s->response_started) {
  -                env->l->jkLog(env, env->l, JK_LOG_DEBUG, 
  -                              "Write without start, starting with defaults\n");
  +                env->l->jkLog(env, env->l, JK_LOG_INFO, 
  +                              "service.write() default head\n");
                   if(!s->head(env, s)) {
                       return JK_FALSE;
                   }
  @@ -225,8 +225,8 @@
               while( ll > 0 ) {
                   unsigned long toSend=(ll>CHUNK_SIZE) ? CHUNK_SIZE : ll;
                   r = ap_rwrite((const char *)bb, toSend, s->ws_private );
  -                env->l->jkLog(env, env->l, JK_LOG_DEBUG, 
  -                              "writing %ld (%ld) out of %ld \n",toSend, r, ll );
  +                env->l->jkLog(env, env->l, JK_LOG_INFO, 
  +                              "service.write()  %ld (%ld) out of %ld \n",toSend, r, ll );
                   ll-=CHUNK_SIZE;
                   bb+=CHUNK_SIZE;
                   
  
  
  
  1.14      +18 -6     jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mod_jk.c	2001/12/16 23:37:13	1.13
  +++ mod_jk.c	2001/12/17 07:17:08	1.14
  @@ -59,7 +59,7 @@
    * Description: Apache 2 plugin for Jakarta/Tomcat                         *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    *                 Henri Gomez <hg...@slib.fr>                               *
  - * Version:     $Revision: 1.13 $                                           *
  + * Version:     $Revision: 1.14 $                                           *
    ***************************************************************************/
   
   /*
  @@ -179,7 +179,9 @@
       
       uriEnv->workerEnv=workerEnv;
       
  -    fprintf(stderr, "XXX Set worker %p %s\n", uriEnv, workerName );
  +    fprintf(stderr, "XXX Set worker %p %s %s dir=%s args=%s\n",
  +            uriEnv, workerName, cmd->path, cmd->directive->directive,
  +            cmd->directive->args);
   
       return NULL;
   }
  @@ -325,11 +327,22 @@
                                       const char *log_level)
   {
       server_rec *s = cmd->server;
  +    jk_env_t *env;
       jk_workerEnv_t *workerEnv =
           (jk_workerEnv_t *)ap_get_module_config(s->module_config, &jk_module);
   
  -    workerEnv->init_data->put( NULL, workerEnv->init_data, "logger.file.level",
  +    env=workerEnv->globalEnv;
  +    
  +    workerEnv->init_data->put( env, workerEnv->init_data, "logger.file.level",
                                  ap_pstrdup(cmd->pool, log_level), NULL);
  +
  +    if(0 == strcasecmp(log_level, JK_LOG_INFO_VERB)) {
  +        env->l->level=JK_LOG_INFO_LEVEL;
  +    }
  +    if(0 == strcasecmp(log_level, JK_LOG_DEBUG_VERB)) {
  +        env->l->level=JK_LOG_DEBUG_LEVEL;
  +    }
  +    
       return NULL;
   }
   
  @@ -1039,7 +1052,6 @@
       worker->get_endpoint(env, worker, &end);
   
       {
  -        int rc = JK_FALSE;
           jk_ws_service_t sOnStack;
           jk_ws_service_t *s=&sOnStack;
           int is_recoverable_error = JK_FALSE;
  @@ -1108,8 +1120,8 @@
           }
   
           env->l->jkLog(env, env->l, JK_LOG_INFO, 
  -                      "PerDir mapping %p %p  %s\n",
  -                      uriEnv->webapp->workerName);
  +                      "PerDir mapping  %s=%s\n",
  +                      r->uri, uriEnv->webapp->workerName);
           
           ap_set_module_config( r->request_config, &jk_module, uriEnv );        
           r->handler=JK_HANDLER;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>