You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/03/30 13:01:31 UTC

svn commit: r390082 - in /webservices/axis2/trunk/c: INSTALL modules/core/transport/http/server/apache2/mod_axis2.c

Author: sahan
Date: Thu Mar 30 03:01:29 2006
New Revision: 390082

URL: http://svn.apache.org/viewcvs?rev=390082&view=rev
Log:
Adding a directive to apache module to specify log level. Updating INSTALL file

Modified:
    webservices/axis2/trunk/c/INSTALL
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c

Modified: webservices/axis2/trunk/c/INSTALL
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/INSTALL?rev=390082&r1=390081&r2=390082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/INSTALL (original)
+++ webservices/axis2/trunk/c/INSTALL Thu Mar 30 03:01:29 2006
@@ -262,8 +262,15 @@
         SetHandler axis2_module
         RepoPath <axis2 repository path>
         LogFile <axis2 log file path>
+        Axis2LogLevel LOG_LEVEL
     </Location>
-
+* LOG_LEVEL can be one of following
+    AXIS2_LOG_LEVEL_CRITICAL - Log critical errors only
+    AXIS2_LOG_LEVEL_ERROR - Log errors critical errors
+    AXIS2_LOG_LEVEL_WARNING - Log warnings and above
+    AXIS2_LOG_LEVEL_INFO - Log info and above
+    AXIS2_LOG_LEVEL_DEBUG - Log debug and above (default)
+    AXIS2_LOG_LEVEL_TRACE - Log trace messages
 * Make sure that the apache2 user has correct permissions to above paths
     - Read permission to the repository
     - Write permission to the log file

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c?rev=390082&r1=390081&r2=390082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c Thu Mar 30 03:01:29 2006
@@ -31,6 +31,7 @@
 {
     char * axis2_log_file;
     char * axis2_repo_path;
+    axis2_log_levels_t log_level;
 }axis2_config_rec_t;
 
 axis2_apache2_worker_t *axis2_worker = NULL;
@@ -42,6 +43,8 @@
                         const char *arg);
 static const char *axis2_set_log_file(cmd_parms *cmd, void *dummy, 
                         const char *arg);
+static const char *axis2_set_log_level(cmd_parms *cmd, void *dummy, 
+                        const char *arg);
 static int axis2_handler(request_rec *req);
 static void axis2_module_init(apr_pool_t* p, server_rec* svr_rec);
 static void axis2_register_hooks(apr_pool_t *p);
@@ -53,6 +56,8 @@
                   "Axis2/C repository path"),
     AP_INIT_TAKE1("LogFile", axis2_set_log_file, NULL, ACCESS_CONF,
                   "Axis2/C log file name"),
+    AP_INIT_TAKE1("Axis2LogLevel", axis2_set_log_level, NULL, ACCESS_CONF,
+                  "Axis2/C log level"),
     {NULL}
 };
 
@@ -72,6 +77,7 @@
     axis2_config_rec_t *conf = apr_palloc(p, sizeof(*conf));
     conf->axis2_log_file = NULL;
     conf->axis2_repo_path = NULL;
+    conf->log_level = AXIS2_LOG_LEVEL_DEBUG;
     /* We need to init xml readers before we go into threaded env
      */
     axis2_xml_reader_init();
@@ -96,6 +102,44 @@
     return NULL;
 }
 
+static const char *axis2_set_log_level(cmd_parms *cmd, void *dummy, 
+                        const char *arg)
+{
+    axis2_log_levels_t level = AXIS2_LOG_LEVEL_DEBUG;
+    axis2_config_rec_t *conf = (axis2_config_rec_t*)ap_get_module_config(
+                        cmd->server->module_config, &axis2_module);
+    
+    if(NULL != arg)
+    {
+        if(!apr_strnatcmp(arg, "AXIS2_LOG_LEVEL_DEBUG"))
+        {
+            level = AXIS2_LOG_LEVEL_DEBUG;
+        }
+        else if(!apr_strnatcmp(arg,"AXIS2_LOG_LEVEL_CRITICAL"))
+        {
+            level = AXIS2_LOG_LEVEL_CRITICAL;
+        }
+        else if(!apr_strnatcmp(arg,"AXIS2_LOG_LEVEL_ERROR"))
+        {
+            level = AXIS2_LOG_LEVEL_ERROR;
+        }
+        else if(!apr_strnatcmp(arg,"AXIS2_LOG_LEVEL_WARNING"))
+        {
+            level = AXIS2_LOG_LEVEL_WARNING;
+        }
+        else if(!apr_strnatcmp(arg,"AXIS2_LOG_LEVEL_INFO"))
+        {
+            level = AXIS2_LOG_LEVEL_INFO;
+        }
+        else if(!apr_strnatcmp(arg,"AXIS2_LOG_LEVEL_TRACE"))
+        {
+            level = AXIS2_LOG_LEVEL_TRACE;
+        }
+    }
+    conf->log_level = level;
+    return NULL;
+}
+
 /* The sample content handler */
 static int axis2_handler(request_rec *req)
 {
@@ -150,6 +194,7 @@
                         "log init failed\n");
         status = AXIS2_FAILURE;
     }
+    axis2_logger->level = conf->log_level;
     thread_pool = axis2_thread_pool_init(allocator);
     if(NULL == thread_pool)
     {
@@ -165,6 +210,8 @@
                         "axis2_environment init failed\n");
         status = AXIS2_FAILURE;
     }
+    AXIS2_LOG_INFO(axis2_env->log, "Starting log with log level %d", 
+                        conf->log_level);
     axis2_worker = axis2_apache2_worker_create(&axis2_env, 
                         conf->axis2_repo_path);
     if(NULL == axis2_worker)