You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2007/10/26 08:14:04 UTC

svn commit: r588535 - in /webservices/axis2/branches/c/29092007: src/core/transport/http/server/simple_axis2_server/http_server_main.c util/include/axutil_log.h util/src/log.c

Author: damitha
Date: Thu Oct 25 23:14:03 2007
New Revision: 588535

URL: http://svn.apache.org/viewvc?rev=588535&view=rev
Log:
When axis2c server starts we can give the maximum log file size in mega bytes.

Modified:
    webservices/axis2/branches/c/29092007/src/core/transport/http/server/simple_axis2_server/http_server_main.c
    webservices/axis2/branches/c/29092007/util/include/axutil_log.h
    webservices/axis2/branches/c/29092007/util/src/log.c

Modified: webservices/axis2/branches/c/29092007/src/core/transport/http/server/simple_axis2_server/http_server_main.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/29092007/src/core/transport/http/server/simple_axis2_server/http_server_main.c?rev=588535&r1=588534&r2=588535&view=diff
==============================================================================
--- webservices/axis2/branches/c/29092007/src/core/transport/http/server/simple_axis2_server/http_server_main.c (original)
+++ webservices/axis2/branches/c/29092007/src/core/transport/http/server/simple_axis2_server/http_server_main.c Thu Oct 25 23:14:03 2007
@@ -100,6 +100,7 @@
     extern char *optarg;
     extern int optopt;
     int c;
+    int log_file_size;
     axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
     const axis2_char_t *log_file = "axis2.log";
     int port = 9090;
@@ -109,7 +110,7 @@
        set with AXIS2_REQUEST_URL_PREFIX macro at compile time */
     axis2_request_url_prefix = AXIS2_REQUEST_URL_PREFIX;
 
-    while ((c = AXIS2_GETOPT(argc, argv, ":p:r:ht:l:f:")) != -1)
+    while ((c = AXIS2_GETOPT(argc, argv, ":p:r:ht:l:s:f:")) != -1)
     {
 
         switch (c)
@@ -130,6 +131,9 @@
             if (log_level > AXIS2_LOG_LEVEL_SERVICE)
                 log_level = AXIS2_LOG_LEVEL_TRACE;
             break;
+        case 's':
+            log_file_size = AXIS2_ATOI(optarg);
+            break;
         case 'f':
             log_file = optarg;
             break;
@@ -157,6 +161,7 @@
 
     env = init_syetem_env(allocator, log_file);
     env->log->level = log_level;
+    env->log->size = 1024 * 1024 * log_file_size;
 
     axutil_error_init();
     system_env = env;
@@ -206,6 +211,7 @@
     fprintf(stdout, " [-r REPO_PATH]");
     fprintf(stdout, " [-l LOG_LEVEL]");
     fprintf(stdout, " [-f LOG_FILE]\n");
+    fprintf(stdout, " [-s LOG_FILE_SIZE]\n");
     fprintf(stdout, " Options :\n");
     fprintf(stdout, "\t-p PORT \t port number to use, default port is 9090\n");
     fprintf(stdout, "\t-r REPO_PATH \t repository path, default is ../\n");
@@ -219,6 +225,8 @@
     fprintf(stdout,
             "\t-f LOG_FILE\t log file, default is $AXIS2C_HOME/logs/axis2.log"
             "\n\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+    fprintf(stdout,
+            "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 8MB.\n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 

Modified: webservices/axis2/branches/c/29092007/util/include/axutil_log.h
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/29092007/util/include/axutil_log.h?rev=588535&r1=588534&r2=588535&view=diff
==============================================================================
--- webservices/axis2/branches/c/29092007/util/include/axutil_log.h (original)
+++ webservices/axis2/branches/c/29092007/util/include/axutil_log.h Thu Oct 25 23:14:03 2007
@@ -127,6 +127,9 @@
 
         /** Log level */
         axutil_log_levels_t level;
+        
+        /** Maximum log file size */
+        int size;
 
         /** Is logging enabled? */
         axis2_bool_t enabled;

Modified: webservices/axis2/branches/c/29092007/util/src/log.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/29092007/util/src/log.c?rev=588535&r1=588534&r2=588535&view=diff
==============================================================================
--- webservices/axis2/branches/c/29092007/util/src/log.c (original)
+++ webservices/axis2/branches/c/29092007/util/src/log.c Thu Oct 25 23:14:03 2007
@@ -169,6 +169,7 @@
             tmp_filename);
     }
     log_impl->file_name = AXIS2_MALLOC(allocator, AXUTIL_LOG_FILE_NAME_SIZE);
+    log_impl->log.size = AXUTIL_LOG_FILE_SIZE;
     sprintf(log_impl->file_name, "%s", log_file_name);
 
     axutil_thread_mutex_lock(log_impl->mutex);
@@ -307,7 +308,7 @@
     if(log_impl->file_name)
         size = axutil_file_handler_size(log_impl->file_name);
   
-    if(size >= AXUTIL_LOG_FILE_SIZE)
+    if(size >= log->size)
     {
         AXIS2_SNPRINTF(old_log_file_name, AXUTIL_LOG_FILE_NAME_SIZE, "%s%s", 
             log_impl->file_name, ".old");



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org