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

2004-06-16 Thread yoavs
yoavs   2004/06/16 07:34:07

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Bugzilla 28469 done.
  
  Revision  ChangesPath
  1.45  +14 -3 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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- jk_logger_file.c  21 Mar 2004 09:43:09 -  1.44
  +++ jk_logger_file.c  16 Jun 2004 14:34:07 -  1.45
  @@ -103,8 +103,17 @@
   apr_status_t rv;
   apr_file_t *oldF = (apr_file_t *) _this->logger_private;
   
  +int closeOld;
   apr_file_t *f = NULL;
   jk_workerEnv_t *workerEnv = env->getByName(env, "workerEnv");
  +
  +/* workaround for APR insanity - APR closes the global system
  +   stderr handle and invalidates all references to stderr if you
  +   call apr_file_close on any stderr reference. Just don't close
  +   stderr references. */
  +closeOld = oldF != NULL && _this->name != NULL &&
  +strcmp("stderr", _this->name) != 0;
  +
   if (!_this->name) {
   _this->name = "${serverRoot}/logs/jk2.log";
   }
  @@ -133,9 +142,11 @@
   }
   _this->jkLog(env, _this, JK_LOG_INFO,
"Initializing log file %s\n", _this->name);
  -if (oldF) {
  -apr_file_close(oldF);
  +
  +if (closeOld) {
  + apr_file_close(oldF);
   }
  +
   return JK_OK;
   }
   
  
  
  

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



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

2003-11-01 Thread mturk
mturk   2003/11/01 06:45:26

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Use the apr file_io for logging.
  
  Revision  ChangesPath
  1.42  +88 -100   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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- jk_logger_file.c  30 Oct 2003 20:08:36 -  1.41
  +++ jk_logger_file.c  1 Nov 2003 14:45:26 -   1.42
  @@ -89,40 +89,34 @@
   
   static const char * jk2_logger_file_logFmt = JK_TIME_FORMAT;
   
  -static void jk2_logger_file_setTimeStr(jk_env_t *env,char * str, int len)
  +static void jk2_logger_file_setTimeStr(jk_env_t *env, char *str, int len)
   {
  -time_t  t = time(NULL);
  -struct tm   *tms;
  +apr_time_exp_t gmt;
  +apr_size_t l;
   
  -tms = gmtime(&t);
  -
  -if( tms==NULL ) {
  -return;
  -}
  -
  -strftime(str, len, jk2_logger_file_logFmt, tms);
  +apr_time_exp_gmt(&gmt, apr_time_now());
  +apr_strftime(str, &l, len, jk2_logger_file_logFmt, &gmt);
   }
   
  -static int JK_METHOD jk2_logger_file_log(jk_env_t *env,jk_logger_t *l,  
   
  +static int JK_METHOD jk2_logger_file_log(jk_env_t *env, jk_logger_t *l, 

  int level,
  const char *what)
   {
  -FILE *f = (FILE *)l->logger_private;
  +apr_status_t rv = APR_SUCCESS;
  +apr_file_t *f = (apr_file_t *)l->logger_private;
   
  -if( f==NULL ) {
  +if (f == NULL) {
   /* This is usefull to debug what happens before logger is set.
  On apache you need -X option ( no detach, single process ) */
  -if( what != NULL ) fprintf(stderr, what );
  +if (what != NULL)
  +fprintf(stderr, what);
   return JK_OK;
   }
   if(l && l->level <= level && l->logger_private && what) {   
  -unsigned sz = strlen(what);
  -if(sz) {
  -fwrite(what, 1, sz, f);
  -/* [V] Flush the dam' thing! */
  -fflush(f);
  -}
  -
  +rv = apr_file_puts(what, f);
  +/* flush the log for each entry only for debug level */
  +if (rv == APR_SUCCESS && l->level == JK_LOG_DEBUG_LEVEL)
  +rv = apr_file_flush(f);
   return JK_OK;
   }
   
  @@ -131,73 +125,72 @@
   
   int jk2_logger_file_parseLogLevel(jk_env_t *env, const char *level)
   {
  -if( level == NULL ) return JK_LOG_INFO_LEVEL;
  +if (!level)
  +return JK_LOG_INFO_LEVEL;
   
  -if(0 == strcasecmp(level, JK_LOG_INFO_VERB)) {
  +if (!strcasecmp(level, JK_LOG_INFO_VERB))
   return JK_LOG_INFO_LEVEL;
  -}
   
  -if(0 == strcasecmp(level, JK_LOG_ERROR_VERB)) {
  +if (!strcasecmp(level, JK_LOG_ERROR_VERB))
   return JK_LOG_ERROR_LEVEL;
  -}
   
  -if(0 == strcasecmp(level, JK_LOG_EMERG_VERB)) {
  +if (!strcasecmp(level, JK_LOG_EMERG_VERB))
   return JK_LOG_EMERG_LEVEL;
  -}
   
   return JK_LOG_DEBUG_LEVEL;
   }
   
  -static int JK_METHOD jk2_logger_file_init(jk_env_t *env,jk_logger_t *_this )
  +static int JK_METHOD jk2_logger_file_init(jk_env_t *env, jk_logger_t *_this )
   {
  -FILE *oldF=(FILE *)_this->logger_private;
  -FILE *f=NULL;
  -jk_workerEnv_t *workerEnv=env->getByName( env, "workerEnv" );
  -if( _this->name==NULL ) {
  +apr_status_t rv;
  +apr_file_t *oldF = (apr_file_t *)_this->logger_private;
  +
  +apr_file_t *f = NULL;
  +jk_workerEnv_t *workerEnv = env->getByName(env, "workerEnv");
  +if (!_this->name) {
   _this->name="${serverRoot}/logs/jk2.log";
   }
   _this->name = jk2_config_replaceProperties(env, workerEnv->initData,
  _this->mbean->pool, _this->name);
  -if( !_this->name || strcmp( "stderr", _this->name )==0 ) {
  -_this->logger_private = stderr;
  -} else {
  -
  -#ifdef AS400
  -f = fopen(_this->name, "a+, o_ccsid=0");
  -#else
  -f = fopen(_this->name, "a+");
  -#endif
  -
  -if(f==NULL) {
  +if (!_this->name || !strcmp("stderr", _this->name)) {
  + if ((rv = apr_file_open_stderr(&f, env->globalPool->_private)) !=
  +APR_SUCCESS) {
  +_this->jkLog(env, _this,JK_LOG_ERROR,
  + "Can't open stderr file\n");
  +return JK_ERR;
  +}
  +_this->logger_private = f;
  +} 
  +else {
  +if ((rv = apr_file_open(&f, _this->name,  
  +APR_APPEND | APR_READ | APR_WRITE | APR_CREATE,
  +APR_OS_DEFAULT,
  +

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

2003-06-09 Thread mturk
mturk   2003/06/09 22:14:28

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Remove the _snprintf WIN32 dependency.
  Thanks to Guenter again for that.
  
  Revision  ChangesPath
  1.39  +8 -15 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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- jk_logger_file.c  9 Jun 2003 10:57:51 -   1.38
  +++ jk_logger_file.c  10 Jun 2003 05:14:28 -  1.39
  @@ -340,23 +340,18 @@
   f++;
   }
   
  -#ifdef WIN32
  - jk2_logger_file_setTimeStr(env,buf, HUGE_BUFFER_SIZE);
  - used = strlen(buf);
  -if( level >= JK_LOG_DEBUG_LEVEL )
  -used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " (%5s) [%s (%d)]: ", 
slevel,  f, line);
  -#elif defined(NETWARE) /* until we get a snprintf function */
  +#if defined(NETWARE) && !defined(__NOVELL_LIBC__) /* until we get a snprintf 
function */
   buf = (char *) malloc(HUGE_BUFFER_SIZE);
   if (NULL == buf)
  return -1;
   
  - jk2_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
  - used = strlen(buf);
  +jk2_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
  +used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
   used += sprintf(&buf[used], " (%5s) [%s (%d)]: ", slevel,  f, line);
   #else 
  - jk2_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE);
  - used = strlen(buf);
  +jk2_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE);
  +used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
   used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " (%5s) [%s (%d)]: ", 
slevel,  f, line);
   #endif
  @@ -364,16 +359,14 @@
   return -1; /* [V] not sure what to return... */
   }
   
  -#ifdef WIN32
  -rc = vsnprintf(buf + used, HUGE_BUFFER_SIZE - used, fmt, args);
  -#elif defined(NETWARE) /* until we get a vsnprintf function */
  +#if defined(NETWARE) && !defined(__NOVELL_LIBC__) /* until we get a vsnprintf 
function */
   rc = vsprintf(buf + used, fmt, args);
   #else 
   rc = vsnprintf(buf + used, HUGE_BUFFER_SIZE - used, fmt, args);
   #endif
   
   l->log(env, l , level, buf);
  -#ifdef NETWARE
  +#if defined(NETWARE) && !defined(__NOVELL_LIBC__)
   free(buf);
   #endif
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_logger_file.c jk_logger_win32.c jk_shm.c jk_user.c

2003-06-09 Thread mturk
mturk   2003/06/09 03:57:51

  Modified:jk/native2/common jk_logger_file.c jk_logger_win32.c
jk_shm.c jk_user.c
  Log:
  Few paches from Gunter to compile under NETWARE.
  
  Revision  ChangesPath
  1.38  +3 -3  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.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- jk_logger_file.c  4 Feb 2003 07:39:59 -   1.37
  +++ jk_logger_file.c  9 Jun 2003 10:57:51 -   1.38
  @@ -344,7 +344,7 @@
jk2_logger_file_setTimeStr(env,buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
  -used += _snprintf(&buf[used], HUGE_BUFFER_SIZE, " (%5s) [%s (%d)]: ", 
slevel,  f, line);
  +used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " (%5s) [%s (%d)]: ", 
slevel,  f, line);
   #elif defined(NETWARE) /* until we get a snprintf function */
   buf = (char *) malloc(HUGE_BUFFER_SIZE);
   if (NULL == buf)
  @@ -365,7 +365,7 @@
   }
   
   #ifdef WIN32
  -rc = _vsnprintf(buf + used, HUGE_BUFFER_SIZE - used, fmt, args);
  +rc = vsnprintf(buf + used, HUGE_BUFFER_SIZE - used, fmt, args);
   #elif defined(NETWARE) /* until we get a vsnprintf function */
   rc = vsprintf(buf + used, fmt, args);
   #else 
  
  
  
  1.9   +1 -0  jakarta-tomcat-connectors/jk/native2/common/jk_logger_win32.c
  
  Index: jk_logger_win32.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_logger_win32.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jk_logger_win32.c 4 Feb 2003 07:39:59 -   1.8
  +++ jk_logger_win32.c 9 Jun 2003 10:57:51 -   1.9
  @@ -229,6 +229,7 @@
   }
   
   #else
  +int JK_METHOD 
   jk2_logger_win32_factory(jk_env_t *env, jk_pool_t *pool, jk_bean_t *result,
  const char *type, const char *name)
   {
  
  
  
  1.34  +1 -1  jakarta-tomcat-connectors/jk/native2/common/jk_shm.c
  
  Index: jk_shm.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_shm.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- jk_shm.c  4 Mar 2003 07:18:04 -   1.33
  +++ jk_shm.c  9 Jun 2003 10:57:51 -   1.34
  @@ -95,7 +95,7 @@
   #define SHM_DUMP 6
   
   
  -#ifdef APR_HAS_MMAP
  +#if (APR_HAS_MMAP == 1)
   
   static int JK_METHOD jk2_shm_destroy(jk_env_t *env, jk_shm_t *shm)
   {
  
  
  
  1.4   +1 -1  jakarta-tomcat-connectors/jk/native2/common/jk_user.c
  
  Index: jk_user.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_user.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_user.c 4 Feb 2003 07:39:58 -   1.3
  +++ jk_user.c 9 Jun 2003 10:57:51 -   1.4
  @@ -59,7 +59,7 @@
   #include "jk_map.h"
   #include "jk_pool.h"
   
  -#ifndef WIN32
  +#if !(defined(WIN32) || defined(NETWARE))
   
   #include 
   #include 
  
  
  

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



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

2002-10-04 Thread mturk

mturk   2002/10/04 09:08:19

  Modified:jk/native2/common jk_logger_file.c
  Log:
  1. Change the default logger to the jk2.log (was mod_jk.log)
  2. Fix the ${serverRoot} replaceProperties.
  3. Do not close log file if it is stderr.
  
  Revision  ChangesPath
  1.35  +8 -7  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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- jk_logger_file.c  27 Sep 2002 13:08:17 -  1.34
  +++ jk_logger_file.c  4 Oct 2002 16:08:19 -   1.35
  @@ -153,11 +153,11 @@
   FILE *f=NULL;
   jk_workerEnv_t *workerEnv=env->getByName( env, "workerEnv" );
   if( _this->name==NULL ) {
  -_this->name="${serverRoot}/logs/mod_jk.log";
  +_this->name="${serverRoot}/logs/jk2.log";
   }
  -jk2_config_replaceProperties( env, workerEnv->initData,
  -  _this->mbean->pool,_this->name);
  -if( strcmp( "stderr", _this->name )==0 ) {
  +_this->name = jk2_config_replaceProperties(env, workerEnv->initData,
  +   _this->mbean->pool, _this->name);
  +if( !_this->name || strcmp( "stderr", _this->name )==0 ) {
   _this->logger_private = stderr;
   } else {
   
  @@ -176,7 +176,7 @@
   } 
   _this->jkLog(env, _this,JK_LOG_INFO,
"Initializing log file %s\n", _this->name );
  -if( oldF!=NULL ) {
  +if( oldF!=NULL && oldF != stderr) {
   fclose( oldF );
   }
   return JK_OK;
  @@ -185,7 +185,8 @@
   static int jk2_logger_file_close(jk_env_t *env,jk_logger_t *_this)
   {
   FILE *f = _this->logger_private;
  -if( f==NULL ) return JK_OK;
  +if (f == NULL || f != stderr)
  +return JK_OK;
   
   fflush(f);
   fclose(f);
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-09-27 Thread mturk

mturk   2002/09/27 06:08:17

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Fix the reported level as INFO not ERROR.
  
  Revision  ChangesPath
  1.34  +2 -2  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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- jk_logger_file.c  24 Sep 2002 22:37:13 -  1.33
  +++ jk_logger_file.c  27 Sep 2002 13:08:17 -  1.34
  @@ -213,7 +213,7 @@
   } else if( strcmp( name, "level" )==0 ) {
   _this->level = jk2_logger_file_parseLogLevel(env, value);
   if( _this->level == 0 ) {
  -_this->jkLog( env, _this, JK_LOG_ERROR,
  +_this->jkLog( env, _this, JK_LOG_INFO,
 "Level %s %d \n", value, _this->level );
   }
   }
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-09-10 Thread mturk

mturk   2002/09/10 06:40:08

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Fix the successful log initialization logging as INFO not as ERROR
  
  Revision  ChangesPath
  1.32  +2 -2  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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- jk_logger_file.c  11 Jun 2002 02:51:18 -  1.31
  +++ jk_logger_file.c  10 Sep 2002 13:40:08 -  1.32
  @@ -168,7 +168,7 @@
   }
   _this->logger_private = f;
   } 
  -_this->jkLog(env, _this,JK_LOG_ERROR,
  +_this->jkLog(env, _this,JK_LOG_INFO,
"Initializing log file %s\n", _this->name );
   if( oldF!=NULL ) {
   fclose( oldF );
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-06-10 Thread nacho

nacho   2002/06/10 15:13:15

  Modified:jk/native2/common jk_logger_file.c
  Log:
  * Added level string to log lines when HAS_APR is not set.
  
  Revision  ChangesPath
  1.29  +23 -5 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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- jk_logger_file.c  10 Jun 2002 21:53:07 -  1.28
  +++ jk_logger_file.c  10 Jun 2002 22:13:15 -  1.29
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.28 $   *
  + * Version: $Revision: 1.29 $   *
***/
   
   
  @@ -265,7 +265,7 @@
   
   /* XXX or apr_ctime ? */
   apr_rfc822_date( rfctime, time );
  -fmt1=apr_psprintf( aprPool, "[%s] (%5s) [%s:%d]  %s", rfctime, slevel, f, 
line, fmt );
  +fmt1=apr_psprintf( aprPool, "[%s] (%5s) [%s (%d)]  %s", rfctime, slevel, f, 
line, fmt );
   buf=apr_pvsprintf( aprPool, fmt1, args );
   
   l->log(env, l, level, buf);
  @@ -300,9 +300,27 @@
   #else
   char buf[HUGE_BUFFER_SIZE];
   #endif
  +char *slevel;
   char *f = (char *)(file + strlen(file) - 1);
   int used = 0;
   
  +switch (level){
  +case JK_LOG_INFO_LEVEL : 
  +slevel=JK_LOG_INFO_VERB;
  +break;
  +case JK_LOG_ERROR_LEVEL : 
  +slevel=JK_LOG_ERROR_VERB;
  +break;
  +case JK_LOG_EMERG_LEVEL : 
  +slevel=JK_LOG_EMERG_VERB;
  +break;
  +case JK_LOG_DEBUG_LEVEL : 
  +default:
  +slevel=JK_LOG_DEBUG_VERB;
  +break;
  +
  +}
  +
   while(f != file && '\\' != *f && '/' != *f) {
   f--;
   }
  @@ -314,7 +332,7 @@
jk2_logger_file_setTimeStr(env,buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
  -used += _snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, 
line);
  +used += _snprintf(&buf[used], HUGE_BUFFER_SIZE, " (%5s) [%s (%d)]: ", 
slevel,  f, line);
   #elif defined(NETWARE) /* until we get a snprintf function */
   buf = (char *) malloc(HUGE_BUFFER_SIZE);
   if (NULL == buf)
  @@ -323,12 +341,12 @@
jk2_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
  -used += sprintf(&buf[used], " [%s (%d)]: ", f, line);
  +used += sprintf(&buf[used], " (%5s) [%s (%d)]: ", slevel,  f, line);
   #else 
jk2_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
  -used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, 
line);
  +used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " (%5s) [%s (%d)]: ", 
slevel,  f, line);
   #endif
   if(used < 0) {
   return -1; /* [V] not sure what to return... */
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-06-10 Thread nacho

nacho   2002/06/10 14:53:07

  Modified:jk/native2/common jk_logger_file.c
  Log:
  * Changed %p format specifiers to %#lx - Thanks to JFC
  * Added level string to log lines.
  
  Revision  ChangesPath
  1.28  +19 -4 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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- jk_logger_file.c  9 Jun 2002 03:00:42 -   1.27
  +++ jk_logger_file.c  10 Jun 2002 21:53:07 -  1.28
  @@ -2,7 +2,7 @@
*   *
* The Apache Software License,  Version 1.1 *
*   *
  - *  Copyright (c) 1999-2001 The Apache Software Foundation.  *
  + *  Copyright (c) 1999-2002 The Apache Software Foundation.  *
*   All rights reserved.*
*   *
* = *
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.27 $   *
  + * Version: $Revision: 1.28 $   *
***/
   
   
  @@ -149,7 +149,6 @@
   return JK_LOG_DEBUG_LEVEL;
   }
   
  -
   static int JK_METHOD jk2_logger_file_init(jk_env_t *env,jk_logger_t *_this )
   {
   FILE *oldF=(FILE *)_this->logger_private;
  @@ -240,7 +239,23 @@
   if(l->logger_private==NULL ||
  l->level <= level) {
   char *f = (char *)(file + strlen(file) - 1);
  +char *slevel;
  +switch (level){
  +case JK_LOG_INFO_LEVEL : 
  +slevel=JK_LOG_INFO_VERB;
  +break;
  +case JK_LOG_ERROR_LEVEL : 
  +slevel=JK_LOG_ERROR_VERB;
  +break;
  +case JK_LOG_EMERG_LEVEL : 
  +slevel=JK_LOG_EMERG_VERB;
  +break;
  +case JK_LOG_DEBUG_LEVEL : 
  +default:
  +slevel=JK_LOG_DEBUG_VERB;
  +break;
   
  +}
   while(f != file && '\\' != *f && '/' != *f) {
   f--;
   }
  @@ -250,7 +265,7 @@
   
   /* XXX or apr_ctime ? */
   apr_rfc822_date( rfctime, time );
  -fmt1=apr_psprintf( aprPool, "[%s] [%s:%d] %s", rfctime, f, line, fmt );
  +fmt1=apr_psprintf( aprPool, "[%s] (%5s) [%s:%d]  %s", rfctime, slevel, f, 
line, fmt );
   buf=apr_pvsprintf( aprPool, fmt1, args );
   
   l->log(env, l, level, buf);
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-06-08 Thread nacho

nacho   2002/06/08 20:00:42

  Modified:jk/native2/common jk_logger_file.c
  Log:
  * Not outputting dates in the file logger, 2 nasty typos in 2 lines.. good 
average!!! :)
  
  Revision  ChangesPath
  1.27  +3 -3  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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- jk_logger_file.c  9 Jun 2002 01:56:41 -   1.26
  +++ jk_logger_file.c  9 Jun 2002 03:00:42 -   1.27
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.26 $   *
  + * Version: $Revision: 1.27 $   *
***/
   
   
  @@ -250,8 +250,8 @@
   
   /* XXX or apr_ctime ? */
   apr_rfc822_date( rfctime, time );
  -fmt1=apr_psprintf( aprPool, "[%s] [%s:%d] %s", rfctime, file, line, fmt );
  -buf=apr_pvsprintf( aprPool, fmt, args );
  +fmt1=apr_psprintf( aprPool, "[%s] [%s:%d] %s", rfctime, f, line, fmt );
  +buf=apr_pvsprintf( aprPool, fmt1, args );
   
   l->log(env, l, level, buf);
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-06-08 Thread nacho

nacho   2002/06/08 18:56:41

  Modified:jk/native2/common jk_logger_file.c
  Log:
  * No warnings
  
  Revision  ChangesPath
  1.26  +4 -2  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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- jk_logger_file.c  9 Jun 2002 00:47:24 -   1.25
  +++ jk_logger_file.c  9 Jun 2002 01:56:41 -   1.26
  @@ -59,16 +59,18 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.25 $   *
  + * Version: $Revision: 1.26 $   *
***/
   
  +
  +#include "apr_strings.h"
  +
   #include "jk_env.h"
   #include "jk_map.h"
   #include "jk_logger.h"
   #include 
   
   #include "jk_registry.h"
  -#include "apr_strings.h"
   
   #define LOG_FORMAT   ("log_format")
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-06-08 Thread nacho

nacho   2002/06/08 17:47:24

  Modified:jk/native2/common jk_logger_file.c
  Log:
  * Fixing the build in win32
  * Cosmetic changes
  
  Revision  ChangesPath
  1.25  +19 -14jakarta-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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_logger_file.c  7 Jun 2002 23:45:30 -   1.24
  +++ jk_logger_file.c  9 Jun 2002 00:47:24 -   1.25
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.24 $   *
  + * Version: $Revision: 1.25 $   *
***/
   
   #include "jk_env.h"
  @@ -68,6 +68,7 @@
   #include 
   
   #include "jk_registry.h"
  +#include "apr_strings.h"
   
   #define LOG_FORMAT   ("log_format")
   
  @@ -90,11 +91,15 @@
   static void jk2_logger_file_setTimeStr(jk_env_t *env,char * str, int len)
   {
time_t  t = time(NULL);
  - struct tm   *tms;
  +struct tm*tms;
   
  - tms = gmtime(&t);
  -if( tms==NULL ) return;
  - strftime(str, len, jk2_logger_file_logFmt, tms);
  +tms = gmtime(&t);
  +
  +if( tms==NULL ) {
  +return;
  +}
  +
  +strftime(str, len, jk2_logger_file_logFmt, tms);
   }
   
   static int JK_METHOD jk2_logger_file_log(jk_env_t *env,jk_logger_t *l,  
   
  @@ -243,7 +248,7 @@
   
   /* XXX or apr_ctime ? */
   apr_rfc822_date( rfctime, time );
  -fmt1=apr_pvsprintf( aprPool, "[%s] [%s:%d] %s", rfctime, file, line, fmt );
  +fmt1=apr_psprintf( aprPool, "[%s] [%s:%d] %s", rfctime, file, line, fmt );
   buf=apr_pvsprintf( aprPool, fmt, args );
   
   l->log(env, l, level, buf);
  @@ -289,8 +294,8 @@
   }
   
   #ifdef WIN32
  - jk2_logger_file_setTimeStr(env,buf, HUGE_BUFFER_SIZE);
  - used = strlen(buf);
  + jk2_logger_file_setTimeStr(env,buf, HUGE_BUFFER_SIZE);
  + used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
   used += _snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, 
line);
   #elif defined(NETWARE) /* until we get a snprintf function */
  @@ -298,18 +303,18 @@
   if (NULL == buf)
  return -1;
   
  - jk2_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
  - used = strlen(buf);
  + jk2_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
  + used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
   used += sprintf(&buf[used], " [%s (%d)]: ", f, line);
   #else 
  - jk2_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE);
  - used = strlen(buf);
  + jk2_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE);
  + used = strlen(buf);
   if( level >= JK_LOG_DEBUG_LEVEL )
   used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, 
line);
   #endif
   if(used < 0) {
  -return 0; /* [V] not sure what to return... */
  +return -1; /* [V] not sure what to return... */
   }
   
   #ifdef WIN32
  @@ -320,7 +325,7 @@
   rc = vsnprintf(buf + used, HUGE_BUFFER_SIZE - used, fmt, args);
   #endif
   
  -l->log(env, l, level, buf);
  +l->log(env, l , level, buf);
   #ifdef NETWARE
   free(buf);
   #endif
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-04-26 Thread nacho

nacho   02/04/26 17:49:10

  Modified:jk/native2/common jk_logger_file.c
  Log:
  * Logger file can use substitutions..
  
  Revision  ChangesPath
  1.21  +5 -8  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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- jk_logger_file.c  25 Apr 2002 18:50:22 -  1.20
  +++ jk_logger_file.c  27 Apr 2002 00:49:10 -  1.21
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.20 $   *
  + * Version: $Revision: 1.21 $   *
***/
   
   #include "jk_env.h"
  @@ -147,15 +147,12 @@
   {
   FILE *oldF=(FILE *)_this->logger_private;
   FILE *f=NULL;
  -
  +jk_workerEnv_t *workerEnv=env->getByName( env, "workerEnv" );
   if( _this->name==NULL ) {
  -jk_workerEnv_t *workerEnv=env->getByName( env, "workerEnv" );
  -
  -_this->name=jk2_config_replaceProperties( env, workerEnv->initData,
  -  _this->mbean->pool,
  -  "${serverRoot}/logs/mod_jk.log");
  +_this->name="${serverRoot}/logs/mod_jk.log";
   }
  -
  +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,
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-04-11 Thread costin

costin  02/04/11 13:23:41

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Another 'default' - if no name is set, default to ${serverRoot}/logs/mod_jk.log.
  
  Revision  ChangesPath
  1.17  +8 -3  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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jk_logger_file.c  26 Mar 2002 03:00:09 -  1.16
  +++ jk_logger_file.c  11 Apr 2002 20:23:41 -  1.17
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.16 $   *
  + * Version: $Revision: 1.17 $   *
***/
   
   #include "jk_env.h"
  @@ -148,8 +148,13 @@
   FILE *oldF=(FILE *)_this->logger_private;
   FILE *f=NULL;
   
  -if( _this->name==NULL )
  -_this->name="mod_jk.log";
  +if( _this->name==NULL ) {
  +jk_workerEnv_t *workerEnv=env->getByName( env, "workerEnv" );
  +
  +_this->name=jk2_config_replaceProperties( env, workerEnv->initData,
  +  _this->mbean->pool,
  +  "${serverRoot}/logs/mod_jk.log");
  +}
   
   f = fopen(_this->name, "a+");
   if(f==NULL) {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-03-18 Thread costin

costin  02/03/18 10:38:40

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Update the file logger to the new config.
  
  Now simple things like changing the log level at runtime are possible.
  
  Revision  ChangesPath
  1.12  +38 -29jakarta-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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- jk_logger_file.c  21 Feb 2002 11:11:15 -  1.11
  +++ jk_logger_file.c  18 Mar 2002 18:38:39 -  1.12
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.11 $   *
  + * Version: $Revision: 1.12 $   *
***/
   
   #include "jk_env.h"
  @@ -74,9 +74,6 @@
   #define HUGE_BUFFER_SIZE (8*1024)
   #define LOG_LINE_SIZE(1024)
   
  -int JK_METHOD jk2_logger_file_factory(jk_env_t *env, jk_pool_t *pool, void **result,
  - const char *type, const char *name);
  -
   
   /* 
* define the log format, we're using by default the one from error.log 
  @@ -145,32 +142,44 @@
   return JK_LOG_DEBUG_LEVEL;
   }
   
  -static int jk2_logger_file_open(jk_env_t *env,jk_logger_t *_this,
  -jk_map_t *properties )
  +static int JK_METHOD
  +jk2_logger_file_setProperty(jk_env_t *env, jk_bean_t *mbean, 
  +char *name,  void *valueP )
  +{
  +jk_logger_t *_this=mbean->object;
  +char *value=valueP;
  +if( strcmp( name, "name" )==0 ) {
  +_this->name=(char *)value;
  +} else if( strcmp( name, "timeFormat" )==0 ) {
  +jk2_logger_file_logFmt = value;
  +} else if( strcmp( name, "level" )==0 ) {
  +_this->level = jk2_logger_file_parseLogLevel(env, value);
  +if( _this->level == 0 ) {
  +_this->jkLog( env, _this, JK_LOG_ERROR,
  +  "Level %s %d \n", value, _this->level );
  +}
  +}
  +}
  +
  +
  +static int jk2_logger_file_init(jk_env_t *env,jk_logger_t *_this )
   {
  -char *file=jk2_map_getStrProp(NULL, properties,"logger","file",
  - "name","mod_jk.log");
  -int level;
  -char *levelS=jk2_map_getStrProp(NULL, properties,"logger","file",
  -   "level", "ERROR");
  -char *logformat=jk2_map_getStrProp(NULL, properties,"logger","file",
  -   "timeFormat", JK_TIME_FORMAT);
   FILE *f;
   
  -_this->level = jk2_logger_file_parseLogLevel(env, levelS);
  +if( _this->name==NULL )
  +_this->name="mod_jk.log";
  +
   if( _this->level == 0 )
  -_this->jkLog( env, _this, JK_LOG_ERROR,
  -  "Level %s %d \n", levelS, _this->level ); 
  +_this->level=JK_LOG_ERROR_LEVEL;
   
  -if( logformat==NULL ) {
  -logformat=JK_TIME_FORMAT;
  +if( jk2_logger_file_logFmt==NULL ) {
  +jk2_logger_file_logFmt = JK_TIME_FORMAT;
   }
  -jk2_logger_file_logFmt = logformat;
   
  -f = fopen(file, "a+");
  +f = fopen(_this->name, "a+");
   if(f==NULL) {
   _this->jkLog(env, _this,JK_LOG_ERROR,
  - "Can't open log file %s\n", file );
  + "Can't open log file %s\n", _this->name );
   return JK_FALSE;
   }
   _this->logger_private = f;
  @@ -266,11 +275,9 @@
   }
   
   
  -int jk2_logger_file_factory(jk_env_t *env,
  -jk_pool_t *pool, 
  -void **result,
  -const char *type,
  -const char *name)
  +int jk2_logger_file_factory(jk_env_t *env, jk_pool_t *pool, 
  +jk_bean_t *result,
  +const char *type, const char *name)
   {
   jk_logger_t *l = (jk_logger_t *)pool->alloc(env, pool, sizeof(jk_logger_t));
   
  @@ -280,11 +287,13 @@
   
   l->log = jk2_logger_file_log;
   l->logger_private = NULL;
  -l->open =jk2_logger_file_open;
  +l->init =jk2_logger_file_init;
   l->jkLog = jk2_logger_file_jkLog;
  -
  -*result=(void *)l;
   l->level=JK_LOG_ERROR_LEVEL;
  +
  +result->object=l;
  +l->mbean=result;
  +result->setAttribute = jk2_logger_file_setProperty;
   
   return JK_TRUE;
   }
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 

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

2001-12-31 Thread costin

costin  01/12/31 11:17:51

  Modified:jk/native2/common jk_logger_file.c jk_map.c
  Log:
  map cleanup for multi-valued properties.
  
  Values are stored using 'add', and concatenated ( if needed ) by the caller,
  using the caller-specified separator ( :, ;, etc - for jni, who was the
  only user of this facility ).
  
  Revision  ChangesPath
  1.10  +2 -1  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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jk_logger_file.c  16 Dec 2001 23:18:11 -  1.9
  +++ jk_logger_file.c  31 Dec 2001 19:17:51 -  1.10
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.9 $   *
  + * Version: $Revision: 1.10 $   *
***/
   
   #include "jk_env.h"
  @@ -284,6 +284,7 @@
   l->jkLog = jk_logger_file_jkLog;
   
   *result=(void *)l;
  +l->level=JK_LOG_ERROR_LEVEL;
   
   return JK_TRUE;
   }
  
  
  
  1.10  +144 -60   jakarta-tomcat-connectors/jk/native2/common/jk_map.c
  
  Index: jk_map.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_map.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jk_map.c  16 Dec 2001 23:29:55 -  1.9
  +++ jk_map.c  31 Dec 2001 19:17:51 -  1.10
  @@ -58,7 +58,7 @@
   /***
* Description: General purpose map object *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.9 $   *
  + * Version: $Revision: 1.10 $   *
***/
   
   #include "jk_global.h"
  @@ -136,7 +136,7 @@
  or none. The caller should do that if he needs !
   */
   /* mPriv->names[mPriv->size] = m->pool->pstrdup(m->pool, name); */
  -mPriv->names[mPriv->size] =  name; 
  +mPriv->names[mPriv->size] =  (char *)name; 
   mPriv->size ++;
   rc = JK_TRUE;
   }
  @@ -164,7 +164,7 @@
  or none. The caller should do that if he needs !
   */
   /* mPriv->names[mPriv->size] = m->pool->pstrdup(m->pool, name); */
  -mPriv->names[mPriv->size] =  name; 
  +mPriv->names[mPriv->size] =  (char *)name; 
   mPriv->size ++;
   rc = JK_TRUE;
   }
  @@ -208,6 +208,11 @@
   
   static void jk_map_default_clear(jk_env_t *env, jk_map_t *m )
   {
  +jk_map_private_t *mPriv;
  +
  +/* assert(m!=NULL) -- we call it via m->... */
  +mPriv=(jk_map_private_t *)m->_private;
  +mPriv->size=0;
   
   }
   
  @@ -217,11 +222,6 @@
   
   }
   
  -
  -
  -/*  */
  -/* General purpose map utils - independent of the map impl */
  -
   int jk_map_append(jk_env_t *env, jk_map_t * dst, jk_map_t * src )
   {
   /* This was badly broken in the original ! */
  @@ -241,6 +241,9 @@
   }
   
   
  +/*  */
  +/* General purpose map utils - independent of the map impl */
  +
   
   char *jk_map_getString(jk_env_t *env, jk_map_t *m,
  const char *name, char *def)
  @@ -251,6 +254,25 @@
   return val;
   }
   
  +int jk_map_getBool(jk_env_t *env, jk_map_t *m,
  +   const char *prop, const char *def)
  +{
  +char *val=jk_map_getString( env, m, prop, (char *)def );
  +
  +if( val==NULL )
  +return JK_FALSE;
  +
  +if( strcmp( val, "1" ) == 0 ||
  +strcmp( val, "true" ) == 0 ||
  +strcmp( val, "TRUE" ) == 0 ||
  +strcmp( val, "True" ) == 0 ||
  +strcmp( val, "on" ) == 0 ||
  +strcmp( val, "On" ) == 0 ||
  +strcmp( val, "ON" ) == 0 ) {
  +return JK_TRUE;
  +}
  +return JK_FALSE;
  +}
   
   /** Get a string property, using the worker's style
   for properties.
  @@ -283,7 +305,6 @@
   return jk_map_str2int( env, val );
   }
   
  -
   /*  */
   /* Conversions */
   
  @@ -418,45 +439,128 @@
   if(strlen(v)==0 || strlen(prp)==0)
   continue;
   
  -oldv = m->get(env, m, prp );
  -
   v = jk_map_replaceProperties(env, m, m

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

2001-12-12 Thread costin

costin  01/12/12 13:54:51

  Modified:jk/native2/common jk_logger_file.c
  Log:
  Few changes to make it consistent with the apache ap_log.
  
  Revision  ChangesPath
  1.6   +7 -4  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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_logger_file.c  2001/12/06 22:59:52 1.5
  +++ jk_logger_file.c  2001/12/12 21:54:51 1.6
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.5 $   *
  + * Version: $Revision: 1.6 $   *
***/
   
   #include "jk_env.h"
  @@ -221,7 +221,8 @@
   #ifdef WIN32
set_time_str(buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
  -used += _snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, line);   
 
  +if( level >= JK_LOG_DEBUG_LEVEL )
  +used += _snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, 
line);
   #elif defined(NETWARE) /* until we get a snprintf function */
   buf = (char *) malloc(HUGE_BUFFER_SIZE);
   if (NULL == buf)
  @@ -229,11 +230,13 @@
   
jk_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
  -used += sprintf(&buf[used], " [%s (%d)]: ", f, line);
  +if( level >= JK_LOG_DEBUG_LEVEL )
  +used += sprintf(&buf[used], " [%s (%d)]: ", f, line);
   #else 
jk_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE);
used = strlen(buf);
  -used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, line);

  +if( level >= JK_LOG_DEBUG_LEVEL )
  +used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, 
line);
   #endif
   if(used < 0) {
   return 0; /* [V] not sure what to return... */
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2001-12-06 Thread costin

costin  01/12/06 14:59:52

  Modified:jk/native2/common jk_logger_file.c jk_map.c
  Log:
  Updates, use pools, etc.
  
  Revision  ChangesPath
  1.5   +7 -6  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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_logger_file.c  2001/12/04 19:11:56 1.4
  +++ jk_logger_file.c  2001/12/06 22:59:52 1.5
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.4 $   *
  + * Version: $Revision: 1.5 $   *
***/
   
   #include "jk_env.h"
  @@ -72,8 +72,8 @@
   #define HUGE_BUFFER_SIZE (8*1024)
   #define LOG_LINE_SIZE(1024)
   
  -int JK_METHOD jk_logger_file_factory(jk_env_t *env, void **result,
  - char *type, char *name);
  +int JK_METHOD jk_logger_file_factory(jk_env_t *env, jk_pool_t *pool, void **result,
  + const char *type, const char *name);
   
   
   /* 
  @@ -260,11 +260,12 @@
   
   
   int jk_logger_file_factory(jk_env_t *env,
  +   jk_pool_t *pool, 
  void **result,
  -   char *type,
  -   char *name)
  +   const char *type,
  +   const char *name)
   {
  -jk_logger_t *l = (jk_logger_t *)malloc(sizeof(jk_logger_t));
  +jk_logger_t *l = (jk_logger_t *)pool->alloc(pool, sizeof(jk_logger_t));
   
   if(l==NULL ) {
   return JK_FALSE;
  
  
  
  1.5   +121 -110  jakarta-tomcat-connectors/jk/native2/common/jk_map.c
  
  Index: jk_map.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_map.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_map.c  2001/12/05 20:48:20 1.4
  +++ jk_map.c  2001/12/06 22:59:52 1.5
  @@ -58,7 +58,7 @@
   /***
* Description: General purpose map object *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.4 $   *
  + * Version: $Revision: 1.5 $   *
***/
   
   #include "jk_global.h"
  @@ -70,8 +70,7 @@
   #define LENGTH_OF_LINE(1024)
   
   struct jk_map {
  -jk_pool_t p;
  -jk_pool_atom_t buf[SMALL_POOL_SIZE];
  +jk_pool_t *pool;
   
   const char **names;
   const void **values;
  @@ -84,53 +83,39 @@
   static int trim(char *s);
   static int map_realloc(jk_map_t *m);
   
  -int map_alloc(jk_map_t **m)
  +int map_alloc(jk_map_t **m, jk_pool_t *pool )
   {
  -if(m) {
  -return map_open(*m = (jk_map_t *)malloc(sizeof(jk_map_t)));
  -}
  -
  -return JK_FALSE;
  -}
  -
  -int map_free(jk_map_t **m)
  -{
  -int rc = JK_FALSE;
  +jk_map_t *_this;
   
  -if(m && *m) {
  -map_close(*m);  
  -free(*m);
  -*m = NULL;
  -}
  +if( m== NULL )
  +return JK_FALSE;
   
  -return rc;
  -}
  -
  -int map_open(jk_map_t *m)
  -{
  -int rc = JK_FALSE;
  +_this=(jk_map_t *)pool->alloc(pool, sizeof(jk_map_t));
  +*m=_this;
   
  -if(m) {
  -jk_open_pool(&m->p, m->buf, sizeof(jk_pool_atom_t) * SMALL_POOL_SIZE);
  -m->capacity = 0;
  -m->size = 0;
  -m->names= NULL;
  -m->values   = NULL;
  -rc = JK_TRUE;
  -}
  +if( _this == NULL )
  +return JK_FALSE;
   
  -return rc;
  +_this->pool = pool;
  +
  +_this->capacity = 0;
  +_this->size = 0;
  +_this->names= NULL;
  +_this->values   = NULL;
  +
  +return JK_TRUE;
   }
   
  -int map_close(jk_map_t *m)
  +int map_free(jk_map_t **m)
   {
   int rc = JK_FALSE;
   
  -if(m) {
  -m->p.close(&m->p);
  +if(m && *m) {
  +(*m)->pool->close((*m)->pool);
   rc = JK_TRUE;
  +/*  free(*m); */
  +*m = NULL;
   }
  -
   return rc;
   }
   
  @@ -204,49 +189,53 @@
   }
   
   char **map_get_string_list(jk_map_t *m,
  +   jk_pool_t *pool,
  co

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

2001-12-01 Thread costin

costin  01/12/01 17:01:42

  Modified:jk/native2/common jk_logger_file.c
  Log:
  The logger will print messages to stdout if it is not opened.
  
  This is usefull for debugging what happens before jk_init() ( the configuration
  stage ).
  
  ( visible with httpd -X )
  
  As soon as we add jk_logger_apache and log to the normal apache log this
  can go away.
  
  Revision  ChangesPath
  1.2   +26 -26jakarta-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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jk_logger_file.c  2001/12/01 22:36:49 1.1
  +++ jk_logger_file.c  2001/12/02 01:01:42 1.2
  @@ -59,7 +59,7 @@
* Description: Utility functions (mainly configuration)   *
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Henri Gomez <[EMAIL PROTECTED]>   *
  - * Version: $Revision: 1.1 $   *
  + * Version: $Revision: 1.2 $   *
***/
   
   #include "jk_util.h"
  @@ -73,6 +73,10 @@
   #define HUGE_BUFFER_SIZE (8*1024)
   #define LOG_LINE_SIZE(1024)
   
  +int JK_METHOD jk_logger_file_factory(jk_env_t *env, void **result,
  + char *type, char *name);
  +
  +
   /* 
* define the log format, we're using by default the one from error.log 
*
  @@ -103,9 +107,16 @@
   unsigned sz = strlen(what);
   if(sz) {
   FILE *f = (FILE *)l->logger_private;
  -fwrite(what, 1, sz, f);
  - /* [V] Flush the dam' thing! */
  - fflush(f);
  +
  +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 );
  +} else { 
  +fwrite(what, 1, sz, f);
  +/* [V] Flush the dam' thing! */
  +fflush(f);
  +}
   }
   
   return JK_TRUE;
  @@ -116,6 +127,8 @@
   
   static int jk_logger_file_parseLogLevel(const char *level)
   {
  +if( level == NULL ) return JK_LOG_ERROR_LEVEL;
  +
   if(0 == strcasecmp(level, JK_LOG_INFO_VERB)) {
   return JK_LOG_INFO_LEVEL;
   }
  @@ -135,17 +148,18 @@
  jk_map_t *properties )
   {
   char *file=map_getStrProp(properties,"logger","file",
  -  "file","mod_jk.log");
  -int level=map_getIntProp(properties,"logger","file",
  - "level", 0);
  +  "name","mod_jk.log");
  +int level;
  +char *levelS=map_getIntProp(properties,"logger","file",
  +"level", "ERROR");
   char *logformat=map_getIntProp(properties,"logger","file",
  "timeFormat", JK_TIME_FORMAT);
   FILE *f;
   
  +_this->level = jk_logger_file_parseLogLevel(levelS);
  +
   jk_logger_file_logFmt = logformat;
   
  -_this->level = level;
  -
   f = fopen(file, "a+");
   if(!f) {
   return JK_FALSE;
  @@ -229,13 +243,8 @@
   rc = vsnprintf(buf + used, HUGE_BUFFER_SIZE - used, fmt, args);
   #endif
   va_end(args);
  -if( l!=NULL ) {
  -l->log(l, level, buf);
  -} else {
  -/* This is usefull to debug what happens before logger is set.
  -   On apache you need -X option ( no detach, single process ) */
  -printf("%s", buf );
  -}
  +
  +l->log(l, level, buf);
   #ifdef NETWARE
   free(buf);
   #endif
  @@ -245,17 +254,6 @@
   }
   
   
  -static int jk_logger_file_fileExists(const char *f)
  -{
  -if(f) {
  -struct stat st;
  -if((0 == stat(f, &st)) && (st.st_mode & S_IFREG)) {
  -return JK_TRUE;
  -}
  -}
  -return JK_FALSE;
  -}
  -
   int jk_logger_file_factory(jk_env_t *env,
  void **result,
  char *type,
  @@ -269,6 +267,8 @@
   
   l->log = jk_logger_file_log;
   l->logger_private = NULL;
  +l->open = jk_logger_file_open;
  +l->jkLog = jk_logger_file_jkLog;
   
   *result=(void *)l;
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2001-12-01 Thread costin

costin  01/12/01 14:36:49

  Added:   jk/native2/common jk_logger_file.c
  Log:
  The logger - using virtual functions.
  
  l->jkLog(l, ... ) should be used instead of jk_log( l, ... ).
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c
  
  Index: jk_logger_file.c
  ===
  /* = *
   *   *
   * The Apache Software License,  Version 1.1 *
   *   *
   *  Copyright (c) 1999-2001 The Apache Software Foundation.  *
   *   All rights reserved.*
   *   *
   * = *
   *   *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *   *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *notice, this list of conditions and the following disclaimer.  *
   *   *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *notice,  this list of conditions  and the following  disclaimer in the *
   *documentation and/or other materials provided with the distribution.   *
   *   *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *must include the following acknowlegement: *
   *   *
   *   "This product includes  software developed  by the Apache  Software *
   *Foundation ."  *
   *   *
   *Alternately, this acknowlegement may appear in the software itself, if *
   *and wherever such third-party acknowlegements normally appear. *
   *   *
   * 4. The names  "The  Jakarta  Project",  "Jk",  and  "Apache  Software *
   *Foundation"  must not be used  to endorse or promote  products derived *
   *from this  software without  prior  written  permission.  For  written *
   *permission, please contact <[EMAIL PROTECTED]>.*
   *   *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *"Apache" appear in their names without prior written permission of the *
   *Apache Software Foundation.*
   *   *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.   *
   *   *
   * = *
   *   *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see .   *
   *   *
   * = */
  
  /**