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 2002/05/29 00:44:50 UTC

cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_logger_file.c jk_endpoint.c

costin      02/05/28 15:44:50

  Modified:    jk/native2/common jk_logger_file.c jk_endpoint.c
  Log:
  Support stderr as a special name for logger.
  
  Few checks for endpoint ( it doesn't have to be associated with a worker )
  
  Revision  Changes    Path
  1.23      +14 -10    jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c
  
  Index: jk_logger_file.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_logger_file.c	16 May 2002 21:03:44 -0000	1.22
  +++ jk_logger_file.c	28 May 2002 22:44:50 -0000	1.23
  @@ -59,7 +59,7 @@
    * Description: Utility functions (mainly configuration)                   *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    * Author:      Henri Gomez <hg...@slib.fr>                               *
  - * Version:     $Revision: 1.22 $                                           *
  + * Version:     $Revision: 1.23 $                                           *
    ***************************************************************************/
   
   #include "jk_env.h"
  @@ -106,7 +106,7 @@
       if( f==NULL ) {
           /* This is usefull to debug what happens before logger is set.
              On apache you need -X option ( no detach, single process ) */
  -        printf("%s", what );
  +        fprintf(stderr, "JK_LOG: %s", what );
           return JK_OK;
       }
       if(l && l->level <= level && l->logger_private && what) {       
  @@ -125,7 +125,7 @@
   
   int jk2_logger_file_parseLogLevel(jk_env_t *env, const char *level)
   {
  -    if( level == NULL ) return JK_LOG_ERROR_LEVEL;
  +    if( level == NULL ) return JK_LOG_INFO_LEVEL;
       
       if(0 == strcasecmp(level, JK_LOG_INFO_VERB)) {
           return JK_LOG_INFO_LEVEL;
  @@ -153,15 +153,19 @@
       }
       jk2_config_replaceProperties( env, workerEnv->initData,
                                                     _this->mbean->pool,_this->name);
  -    f = fopen(_this->name, "a+");
  -    if(f==NULL) {
  -        _this->jkLog(env, _this,JK_LOG_ERROR,
  -                     "Can't open log file %s\n", _this->name );
  -        return JK_ERR;
  -    }
  +    if( strcmp( "stderr", _this->name )==0 ) {
  +        _this->logger_private = stderr;
  +    } else {
  +        f = fopen(_this->name, "a+");
  +        if(f==NULL) {
  +            _this->jkLog(env, _this,JK_LOG_ERROR,
  +                         "Can't open log file %s\n", _this->name );
  +            return JK_ERR;
  +        }
  +        _this->logger_private = f;
  +    } 
       _this->jkLog(env, _this,JK_LOG_ERROR,
                    "Initializing log file %s\n", _this->name );
  -    _this->logger_private = f;
       if( oldF!=NULL ) {
           fclose( oldF );
       }
  
  
  
  1.16      +3 -3      jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c
  
  Index: jk_endpoint.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_endpoint.c	27 May 2002 21:57:45 -0000	1.15
  +++ jk_endpoint.c	28 May 2002 22:44:50 -0000	1.16
  @@ -96,14 +96,14 @@
           stats= & statArray[ ep->mbean->id ];
           ep->workerEnv->epStat->structSize=sizeof( jk_stat_t );
           ep->workerEnv->epStat->structCnt=ep->mbean->id + 1;
  -        if( ep->worker->mbean->debug > 0 )
  +        if( ep->worker != NULL && ep->worker->mbean->debug > 0 )
               env->l->jkLog(env, env->l, JK_LOG_INFO,
                             "SHM stats %d %p %p %s %s childId=%d\n", ep->mbean->id,
                             ep->workerEnv->epStat->data, stats,
                             ep->mbean->localName, ep->mbean->name, ep->workerEnv->childId);
       } else {
           stats = (jk_stat_t *)ep->mbean->pool->calloc( env, ep->mbean->pool, sizeof( jk_stat_t ) );
  -        if( ep->worker->mbean->debug > 0 )
  +        if( ep->worker != NULL && ep->worker->mbean->debug > 0 )
               env->l->jkLog(env, env->l, JK_LOG_INFO,
                             "Local stats %d %p %d\n", ep->mbean->id, ep->workerEnv->epStat, ep->workerEnv->childId );
       }
  @@ -125,7 +125,7 @@
                             jk_bean_t *result,
                         const char *type, const char *name)
   {
  -    jk_endpoint_t *e = (jk_endpoint_t *)pool->alloc(env, pool,
  +    jk_endpoint_t *e = (jk_endpoint_t *)pool->calloc(env, pool,
                                                       sizeof(jk_endpoint_t));
       int epId;
   
  
  
  

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