cvs commit: jakarta-tomcat-connectors/jk/native/common jk_logger.h jk_util.c jk_util.h

2004-11-11 Thread mturk
mturk   2004/11/11 01:44:30

  Modified:jk/native/common jk_logger.h jk_util.c jk_util.h
  Log:
  Add __FUNCTION__ as parameter for jk_log.
  The function name will be expanded for GCC and MSVC.
  Other compilers like CW does not expand function name.
  
  Revision  ChangesPath
  1.14  +19 -11jakarta-tomcat-connectors/jk/native/common/jk_logger.h
  
  Index: jk_logger.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_logger.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- jk_logger.h   10 Nov 2004 16:36:48 -  1.13
  +++ jk_logger.h   11 Nov 2004 09:44:29 -  1.14
  @@ -66,27 +66,35 @@
   #define JK_LOG_ERROR_VERB   "error"
   #define JK_LOG_EMERG_VERB   "emerg"
   
  -#define JK_LOG_TRACE   __FILE__,__LINE__,JK_LOG_TRACE_LEVEL
  -#define JK_LOG_DEBUG   __FILE__,__LINE__,JK_LOG_DEBUG_LEVEL
  -#define JK_LOG_INFO__FILE__,__LINE__,JK_LOG_INFO_LEVEL
  -#define JK_LOG_WARNING __FILE__,__LINE__,JK_LOG_WARNING_LEVEL
  -#define JK_LOG_ERROR   __FILE__,__LINE__,JK_LOG_ERROR_LEVEL
  -#define JK_LOG_EMERG   __FILE__,__LINE__,JK_LOG_EMERG_LEVEL
  -#define JK_LOG_REQUEST __FILE__,0,JK_LOG_REQUEST_LEVEL
  +#if defined(__GCC__) || defined(_MSC_VER)
  +#define JK_LOG_TRACE   __FILE__,__LINE__,__FUNCTION__,JK_LOG_TRACE_LEVEL
  +#define JK_LOG_DEBUG   __FILE__,__LINE__,__FUNCTION__,JK_LOG_DEBUG_LEVEL
  +#define JK_LOG_ERROR   __FILE__,__LINE__,__FUNCTION__,JK_LOG_ERROR_LEVEL
  +#define JK_LOG_EMERG   __FILE__,__LINE__,__FUNCTION__,JK_LOG_EMERG_LEVEL
  +#else
  +#define JK_LOG_TRACE   __FILE__,__LINE__,NULL,JK_LOG_TRACE_LEVEL
  +#define JK_LOG_DEBUG   __FILE__,__LINE__,NULL,JK_LOG_DEBUG_LEVEL
  +#define JK_LOG_ERROR   __FILE__,__LINE__,NULL,JK_LOG_ERROR_LEVEL
  +#define JK_LOG_EMERG   __FILE__,__LINE__,NULL,JK_LOG_EMERG_LEVEL
  +#endif
  +
  +#define JK_LOG_INFO__FILE__,__LINE__,NULL,JK_LOG_INFO_LEVEL
  +#define JK_LOG_WARNING __FILE__,__LINE__,NULL,JK_LOG_WARNING_LEVEL
  +#define JK_LOG_REQUEST __FILE__,0,NULL,JK_LOG_REQUEST_LEVEL
   
   /* Debug level is compile time only 
*/
   #if defined (DEBUG) || (_DEBUG)
   #define JK_TRACE1
  -#define JK_TRACE_ENTER(l) jk_log((l), JK_LOG_TRACE, "enter " __FUNCTION__ 
"\n")
  -#define JK_TRACE_EXIT(l)  jk_log((l), JK_LOG_TRACE, "exit " __FUNCTION__ 
"\n")
  +#define JK_TRACE_ENTER(l) jk_log((l), JK_LOG_TRACE, "enter\n")
  +#define JK_TRACE_EXIT(l)  jk_log((l), JK_LOG_TRACE, "exit\n")
   #else
   #define JK_TRACE0
   #define JK_TRACE_ENTER(l)
   #define JK_TRACE_EXIT(l)
   #endif
   
  -#define JK_LOG_NULL_PARAMS(l) jk_log((l), JK_LOG_ERROR, __FUNCTION__ " NULL 
parameters\n")
  +#define JK_LOG_NULL_PARAMS(l) jk_log((l), JK_LOG_ERROR, "NULL parameters\n")
   
   
   
  
  
  
  1.34  +3 -2  jakarta-tomcat-connectors/jk/native/common/jk_util.c
  
  Index: jk_util.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_util.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- jk_util.c 9 Nov 2004 12:17:43 -   1.33
  +++ jk_util.c 11 Nov 2004 09:44:29 -  1.34
  @@ -218,7 +218,8 @@
   }
   
   int jk_log(jk_logger_t *l,
  -   const char *file, int line, int level, const char *fmt, ...)
  +   const char *file, int line, const char *funcname, int level,
  +   const char *fmt, ...)
   {
   int rc = 0;
   if (!l || !file || !fmt) {
  
  
  
  1.20  +3 -2  jakarta-tomcat-connectors/jk/native/common/jk_util.h
  
  Index: jk_util.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_util.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- jk_util.h 10 Nov 2004 16:36:48 -  1.19
  +++ jk_util.h 11 Nov 2004 09:44:29 -  1.20
  @@ -36,7 +36,8 @@
   int jk_close_file_logger(jk_logger_t **l);
   
   int jk_log(jk_logger_t *l,
  -   const char *file, int line, int level, const char *fmt, ...);
  +   const char *file, int line, const char *funcname, int level,
  +   const char *fmt, ...);
   
   /* [V] Two general purpose functions. Should ease the function bloat. */
   int jk_get_worker_str_prop(jk_map_t *m,
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_logger.h jk_util.c

2003-02-28 Thread glenn
glenn   2003/02/28 09:58:40

  Modified:jk/native/apache-2.0 mod_jk.c
   jk/native/common jk_logger.h jk_util.c
  Log:
  Use APR for Apache 2.0 mod_jk logging so that piped logs can be used
  
  Revision  ChangesPath
  1.66  +187 -55   jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- mod_jk.c  7 Jan 2003 01:27:11 -   1.65
  +++ mod_jk.c  28 Feb 2003 17:58:39 -  1.66
  @@ -72,6 +72,7 @@
   #include "apr_lib.h"
   #include "apr_date.h"
   #include "apr_file_info.h"
  +#include "apr_file_io.h"
   #include "httpd.h"
   #include "http_config.h"
   #include "http_request.h"
  @@ -109,6 +110,7 @@
   #include "jk_service.h"
   #include "jk_worker.h"
   #include "jk_uri_worker_map.h"
  +#include "jk_logger.h"
   
   #define JK_WORKER_ID("jakarta.worker")
   #define JK_HANDLER  ("jakarta-servlet")
  @@ -127,7 +129,6 @@
   /* module MODULE_VAR_EXPORT jk_module; */
   AP_MODULE_DECLARE_DATA module jk_module;
   
  -
   typedef struct {
   
   /*
  @@ -136,6 +137,7 @@
   char *log_file;
   int  log_level;
   jk_logger_t *log;
  +apr_file_t *jklogfp;
   
   /*
* Worker stuff
  @@ -199,7 +201,7 @@
   
   static jk_logger_t * main_log = NULL;
   static jk_worker_env_t   worker_env;
  -
  +static apr_global_mutex_t *jk_log_lock = NULL;
   
   static int JK_METHOD ws_start_response(jk_ws_service_t *s,
  int status,
  @@ -313,8 +315,9 @@
   int long rv = OK;
   if (rv = ap_change_request_body_xlate(p->r, 65535, 65535)) /* turn off request 
body translation*/
   { 
  -ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 
  - NULL, "mod_jk: Error on ap_change_request_body_xlate, rc=%d 
\n", rv);
  +ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
  + "mod_jk: Error on ap_change_request_body_xlate, rc=%d \n",
  + rv);
   return JK_FALSE;
   }
   #else
  @@ -382,12 +385,12 @@
   #ifdef AS400
   rc = ap_change_response_body_xlate(p->r, 65535, 65535); /* turn off 
response body translation*/
if(rc){
  -ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 
  - NULL, "mod_jk: Error on ap_change_response_body_xlate, 
rc=%d \n", rc);
  - return JK_FALSE; 
  +ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
  + "mod_jk: Error on ap_change_response_body_xlate, rc=%d 
\n", rc);
  + return JK_FALSE;
   }
   #endif
  -
  +
   /* Debug - try to get around rwrite */
   while( ll > 0 ) {
   size_t toSend=(ll>CHUNK_SIZE) ? CHUNK_SIZE : ll;
  @@ -858,9 +861,12 @@
   jk_server_conf_t *conf =
   (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
   
  -/* we need an absolut path */
  -conf->log_file = ap_server_root_relative(cmd->pool,log_file);
  - 
  +/* we need an absolute path */
  +if (*log_file != '|' )
  +conf->log_file = ap_server_root_relative(cmd->pool,log_file);
  +else
  +conf->log_file = apr_pstrdup(cmd->pool, log_file);
  +
   if (conf->log_file == NULL)
   return "JkLogFile file_name invalid";
   
  @@ -971,7 +977,7 @@
   }
   *s = 0;
   
  -jk_log(conf->log ? conf->log : main_log, JK_LOG_REQUEST, str);
  +jk_log(main_log, JK_LOG_REQUEST, str);
   }
   
   /*
  @@ -1651,7 +1657,6 @@
   {   
   const char   *worker_name;
   jk_server_conf_t *xconf;
  -jk_logger_t  *xl;
   jk_server_conf_t *conf;
   int  rc,dmt=1;
   
  @@ -1672,7 +1677,6 @@
   return DECLINED;
   
   worker_name = apr_table_get(r->notes, JK_WORKER_ID);
  -xl = xconf->log ? xconf->log : main_log;
   
   /* Set up r->read_chunked flags for chunked encoding, if present */
   if(rc = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) {
  @@ -1690,22 +1694,21 @@
 I'm not sure how ). We also have a manual config directive that
 explicitely give control to us. */
 worker_name=  worker_env.first_worker;
  -  jk_log(xl, JK_LOG_DEBUG, 
  +  jk_log(main_log, JK_LOG_DEBUG, 
"Manual configuration for %s %s %d\n",
r->uri, worker_env.first_worker, worker_env.num_of_workers); 
 } else {
  -  worker_name = map_uri_to_worker(xconf->uw_map, r->uri, 
  -