Hi Damitha,
   Looks like you are doing some changes on the log file size.
   Could you please explain what your are planing to do here?

Also, I see that the change is incorporated to the simple axis server. What about the tcp server and the httpd module? Please explain.

Thanks,
Samisa...


-------- Original Message --------
Subject: svn commit: r590865 - in /webservices/axis2/trunk/c: src/core/transport/http/server/simple_axis2_server/http_server_main.c util/include/axutil_file_handler.h util/include/axutil_log.h util/src/file_handler.c util/src/log.c
Date:   Thu, 01 Nov 2007 00:06:33 -0000
From:   [EMAIL PROTECTED]
To:     [EMAIL PROTECTED]



Author: damitha
Date: Wed Oct 31 17:06:33 2007
New Revision: 590865

URL: http://svn.apache.org/viewvc?rev=590865&view=rev
Log:
Fixing AXIS2C-732 and AXIS2C-734

Modified:
   
webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c
   webservices/axis2/trunk/c/util/include/axutil_file_handler.h
   webservices/axis2/trunk/c/util/include/axutil_log.h
   webservices/axis2/trunk/c/util/src/file_handler.c
   webservices/axis2/trunk/c/util/src/log.c

Modified: 
webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c?rev=590865&r1=590864&r2=590865&view=diff
==============================================================================
--- 
webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c
 (original)
+++ 
webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c
 Wed Oct 31 17:06:33 2007
@@ -30,18 +30,6 @@
#include <axiom_xml_reader.h>
#include <axutil_version.h>

-#ifndef AXIS2_HTTP_SERVER_LOG_FILE_NAME
-#define AXIS2_HTTP_SERVER_LOG_FILE_NAME "axis2_http_server.log"
-#endif
-
-#ifndef AXIS2_HTTP_SERVER_PORT
-#define AXIS2_HTTP_SERVER_PORT 9090
-#endif
-
-#ifndef AXIS2_HTTP_SERVER_REPO_PATH
-#define AXIS2_HTTP_SERVER_REPO_PATH "../"
-#endif
-
axutil_env_t *system_env = NULL;
axis2_transport_receiver_t *server = NULL;
AXIS2_IMPORT extern int axis2_http_socket_read_timeout;
@@ -112,16 +100,17 @@
    extern char *optarg;
    extern int optopt;
    int c;
+    int log_file_size = AXUTIL_LOG_FILE_SIZE;
    axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
-    const axis2_char_t *log_file = AXIS2_HTTP_SERVER_LOG_FILE_NAME;
-    int port = AXIS2_HTTP_SERVER_PORT;
-    const axis2_char_t *repo_path = AXIS2_HTTP_SERVER_REPO_PATH;
+    const axis2_char_t *log_file = "axis2.log";
+    int port = 9090;
+    const axis2_char_t *repo_path = "../";

/* Set the service URL prefix to be used. This could default to services if not 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)
@@ -139,9 +128,12 @@
            log_level = AXIS2_ATOI(optarg);
            if (log_level < AXIS2_LOG_LEVEL_CRITICAL)
                log_level = AXIS2_LOG_LEVEL_CRITICAL;
-            if (log_level > AXIS2_LOG_LEVEL_TRACE)
+            if (log_level > AXIS2_LOG_LEVEL_SERVICE)
                log_level = AXIS2_LOG_LEVEL_TRACE;
            break;
+        case 's':
+            log_file_size = 1024 * 1024 * AXIS2_ATOI(optarg);
+            break;
        case 'f':
            log_file = optarg;
            break;
@@ -169,6 +161,7 @@

    env = init_syetem_env(allocator, log_file);
    env->log->level = log_level;
+    env->log->size = log_file_size;

    axutil_error_init();
    system_env = env;
@@ -218,19 +211,22 @@
    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 %d\n", 
AXIS2_HTTP_SERVER_PORT);
+    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");
    fprintf(stdout,
            "\t-t TIMEOUT\t socket read timeout, default is 30 seconds\n");
    fprintf(stdout,
            "\t-l LOG_LEVEL\t log level, available log levels:"
            "\n\t\t\t 0 - critical    1 - errors 2 - warnings"
-            "\n\t\t\t 3 - information 4 - debug  5- trace"
+            "\n\t\t\t 3 - information 4 - debug  5- trace 6- service"
            "\n\t\t\t Default log level is 4(debug).\n");
    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");
}

@@ -243,13 +239,26 @@
sig_handler(
    int signal)
{
+
+    if (!system_env)
+    {
+        AXIS2_LOG_ERROR(system_env->log, AXIS2_LOG_SI,
+                        "Received signal %d, unable to proceed system_env is 
NULL ,\
+                         system exit with -1", signal);
+        _exit (-1);
+    }
+
    switch (signal)
    {
    case SIGINT:
        {
            AXIS2_LOG_INFO(system_env->log, "Received signal SIGINT. Server "
                           "shutting down");
-            axis2_http_server_stop(server, system_env);
+            if (server)
+            {
+                axis2_http_server_stop(server, system_env);
+            }
+
            AXIS2_LOG_INFO(system_env->log, "Shutdown complete ...");
            system_exit(system_env, 0);
        }

Modified: webservices/axis2/trunk/c/util/include/axutil_file_handler.h
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axutil_file_handler.h?rev=590865&r1=590864&r2=590865&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axutil_file_handler.h (original)
+++ webservices/axis2/trunk/c/util/include/axutil_file_handler.h Wed Oct 31 
17:06:33 2007
@@ -19,6 +19,7 @@
#define AXUTIL_FILE_HANDLER_H

#include <axutil_string.h>
+#include <stdio.h>

#ifdef __cplusplus
extern "C"
@@ -71,6 +72,15 @@
    axutil_file_handler_access(
        const axis2_char_t * path,
        int mode);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axutil_file_handler_copy(
+ FILE *from, + FILE *to);
+
+ long + axutil_file_handler_size(
+        const axis2_char_t *const name);

    /** @} */


Modified: webservices/axis2/trunk/c/util/include/axutil_log.h
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axutil_log.h?rev=590865&r1=590864&r2=590865&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axutil_log.h (original)
+++ webservices/axis2/trunk/c/util/include/axutil_log.h Wed Oct 31 17:06:33 2007
@@ -38,8 +38,22 @@
     */

    /**
-     * Axis2 log levels.
-     */
+      *Examples
+      *To write debug information to log
+      *AXIS2_LOG_DEBUG(log,AXIS2_LOG_SI,"log this %s %d","test",123);
+      *This would log
+      *"log this test 123" into the log file
+      *
+      *similar macros are defined for different log levels: 
CRITICAL,ERROR,WARNING and INFO
+      * and SERVICE
+      *
+ *CRITICAL and ERROR logs are always written to file and other logs are written + *depending on the log level set (log->level)
+      */
+
+    /**
+      * \brief Axis2 log levels
+      */
    typedef enum axutil_log_levels
    {

@@ -59,23 +73,25 @@
        AXIS2_LOG_LEVEL_DEBUG,

        /** Trace level, Enable with compiler time option AXIS2_TRACE */
-        AXIS2_LOG_LEVEL_TRACE
+        AXIS2_LOG_LEVEL_TRACE,
+ + /** Service level, logs only service level debug messages */
+        AXIS2_LOG_LEVEL_SERVICE
    } axutil_log_levels_t;

    /**
-     * Axis2 log ops struct.
-     *
-     * Encapsulator struct for ops of axutil_log.
-     */
+      * \brief Axis2 log ops struct
+      *
+      * Encapsulator struct for ops of axutil_log
+      */
    struct axutil_log_ops
    {

        /**
-         * Frees the log.
-         * @param allocator pointer allocator to be used to free the struct
-         * @param log pointer to log struct instance to be freed
- * @return void + * deletes the log
+         * @return axis2_status_t AXIS2_SUCCESS on success else AXIS2_FAILURE
         */
+
        void(
            AXIS2_CALL
            * free)(
@@ -83,14 +99,11 @@
                struct axutil_log * log);

        /**
-         * Writes to the log.
-         * @param log pointer to log struct instance
-         * @param buffer buffer to be written to log
- * @param level log level, one of axutil_log_levels enum values - * @param file name of the source file from which the log is written
-         * @param line line number of the source file from which the log is 
written
-         * @return void
-         */
+          * writes to the log
+          * @param buffer buffer to be written to log
+          * @param size size of the buffer to be written to log
+          * @return satus of the op. AXIS2_SUCCESS on success else 
AXIS2_FAILURE
+          */
        void(
            AXIS2_CALL
            * write)(
@@ -102,17 +115,21 @@
    };

    /**
-     * Axis2 Log struct.
-     * Log is the encapsulating struct for all log related data and operations.
-     */
+      * \brief Axis2 Log struct
+      *
+      * Log is the encapsulating struct for all log related data and ops
+      */
    struct axutil_log
    {

-        /** Log related operations */
+        /** Log related ops */
        const axutil_log_ops_t *ops;

        /** Log level */
        axutil_log_levels_t level;
+ + /** Maximum log file size */
+        int size;

        /** Is logging enabled? */
        axis2_bool_t enabled;
@@ -150,6 +167,14 @@
        ...);

    AXIS2_EXTERN void AXIS2_CALL
+    axutil_log_impl_log_service(
+        axutil_log_t * log,
+        const axis2_char_t * filename,
+        const int linenumber,
+        const axis2_char_t * format,
+        ...);
+
+    AXIS2_EXTERN void AXIS2_CALL
    axutil_log_impl_log_debug(
        axutil_log_t * log,
        const axis2_char_t * filename,
@@ -178,12 +203,14 @@
        const axis2_char_t * file,
        const int line);

+
#define AXIS2_LOG_FREE(allocator, log) \
      axutil_log_free(allocator, log)

#define AXIS2_LOG_WRITE(log, buffer, level, file) \
      axutil_log_write(log, buffer, level, file, AXIS2_LOG_SI)

+#define AXIS2_LOG_SERVICE axutil_log_impl_log_service
#define AXIS2_LOG_DEBUG axutil_log_impl_log_debug
#define AXIS2_LOG_INFO axutil_log_impl_log_info
#define AXIS2_LOG_WARNING axutil_log_impl_log_warning

Modified: webservices/axis2/trunk/c/util/src/file_handler.c
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/file_handler.c?rev=590865&r1=590864&r2=590865&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/file_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/file_handler.c Wed Oct 31 17:06:33 2007
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <platforms/axutil_platform_auto_sense.h>
+#include <sys/stat.h>

#include <axutil_file_handler.h>

@@ -67,3 +68,43 @@
    }
    return status;
}
+
+axis2_status_t
+axutil_file_handler_copy(
+ FILE *from, + FILE *to)
+{
+    axis2_char_t ch;
+ + /* It is assumed that source and destination files are accessible and open*/ + while(!feof(from)) + {
+        ch = fgetc(from);
+ if(ferror(from)) + {
+            /* Error reading source file */
+            return AXIS2_FAILURE;
+        }
+        if(!feof(from)) fputc(ch, to);
+ if(ferror(to)) + {
+            /* Error writing destination file */
+            return AXIS2_FAILURE;
+        }
+    }
+    return AXIS2_SUCCESS;
+}
+
+long +axutil_file_handler_size(
+    const axis2_char_t *const name)
+{
+    struct stat stbuf;
+    if(stat(name, &stbuf) == -1)
+    {
+        /* The file could not be accessed */
+        return AXIS2_FAILURE;
+    }
+    return stbuf.st_size;
+}
+

Modified: webservices/axis2/trunk/c/util/src/log.c
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/log.c?rev=590865&r1=590864&r2=590865&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/log.c (original)
+++ webservices/axis2/trunk/c/util/src/log.c Wed Oct 31 17:06:33 2007
@@ -23,10 +23,13 @@
#include <axutil_log_default.h>
#include <axutil_file_handler.h>
#include <axutil_thread.h>
-#include <signal.h>

typedef struct axutil_log_impl axutil_log_impl_t;

+static axis2_status_t
+axutil_log_impl_rotate(
+    axutil_log_t * log);
+
static void AXIS2_CALL axutil_log_impl_write(
    axutil_log_t * log,
    const axis2_char_t * buffer,
@@ -35,7 +38,7 @@
    const int line);

AXIS2_EXTERN void AXIS2_CALL axutil_log_impl_write_to_file(
-    FILE * fd,
+    axutil_log_t * log,
    axutil_thread_mutex_t * mutex,
    axutil_log_levels_t level,
    const axis2_char_t * file,
@@ -50,6 +53,7 @@
{
    axutil_log_t log;
    void *stream;
+    axis2_char_t *file_name;
    axutil_thread_mutex_t *mutex;
};

@@ -75,12 +79,13 @@
        {
            axutil_thread_mutex_destroy(log_impl->mutex);
        }
-        if (AXIS2_INTF_TO_IMPL(log)->stream)
+        if (log_impl->stream)
        {
-            if (log_impl->stream)
-            {
-                axutil_file_handler_close(log_impl->stream);
-            }
+            axutil_file_handler_close(log_impl->stream);
+        }
+        if (log_impl->file_name)
+        {
+            AXIS2_FREE(allocator, log_impl->file_name);
        }
        AXIS2_FREE(allocator, log_impl);
    }
@@ -95,8 +100,8 @@
{
    axutil_log_impl_t *log_impl;
    axis2_char_t *path_home;
-    axis2_char_t log_file_name[500];
-    axis2_char_t log_dir[500];
+    axis2_char_t log_file_name[AXUTIL_LOG_FILE_NAME_SIZE];
+    axis2_char_t log_dir[AXUTIL_LOG_FILE_NAME_SIZE];
    axis2_char_t tmp_filename[100];

    if (!allocator)
@@ -118,10 +123,6 @@
        return NULL;
    }

-#ifndef WIN32
-    signal(SIGXFSZ, SIG_IGN);
-#endif
-
    /* default log file is axis2.log */
    if (stream_name)
        AXIS2_SNPRINTF(tmp_filename, 100, "%s", stream_name);
@@ -135,37 +136,43 @@
    {
        if ((path_home = AXIS2_GETENV("AXIS2C_HOME")))
        {
-            AXIS2_SNPRINTF(log_dir, 500, "%s%c%s", path_home,
-                           AXIS2_PATH_SEP_CHAR, "logs");
+ AXIS2_SNPRINTF(log_dir, AXUTIL_LOG_FILE_NAME_SIZE, "%s%c%s", + path_home, AXIS2_PATH_SEP_CHAR, "logs");
            if (AXIS2_SUCCESS ==
                axutil_file_handler_access(log_dir, AXIS2_F_OK))
            {
-                AXIS2_SNPRINTF(log_file_name, 500, "%s%c%s", log_dir,
-                               AXIS2_PATH_SEP_CHAR, tmp_filename);
+ AXIS2_SNPRINTF(log_file_name, AXUTIL_LOG_FILE_NAME_SIZE, + "%s%c%s", log_dir, AXIS2_PATH_SEP_CHAR, tmp_filename);
            }
            else
            {
-                fprintf(stderr,
-                        "log folder %s does not exist - log file %s is written to . 
dir\n",
-                        log_dir, tmp_filename);
-                AXIS2_SNPRINTF(log_file_name, 500, "%s", tmp_filename);
+                fprintf(stderr, "log folder %s does not exist - log file %s "\
+                    "is written to . dir\n", log_dir, tmp_filename);
+ AXIS2_SNPRINTF(log_file_name, AXUTIL_LOG_FILE_NAME_SIZE, "%s", + tmp_filename);
            }
        }
        else
        {
            fprintf(stderr,
                    "AXIS2C_HOME is not set - log is written to . dir\n");
-            AXIS2_SNPRINTF(log_file_name, 500, "%s", tmp_filename);
+ AXIS2_SNPRINTF(log_file_name, AXUTIL_LOG_FILE_NAME_SIZE, "%s", + tmp_filename);
        }
    }
    else
    {
-        AXIS2_SNPRINTF(log_file_name, 500, "%s", tmp_filename);
+ AXIS2_SNPRINTF(log_file_name, AXUTIL_LOG_FILE_NAME_SIZE, "%s", + 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);

    log_impl->stream = axutil_file_handler_open(log_file_name, "a+");
+    axutil_log_impl_rotate((axutil_log_t *) log_impl);

    axutil_thread_mutex_unlock(log_impl->mutex);

@@ -222,6 +229,8 @@
            case AXIS2_LOG_LEVEL_TRACE:
                level_str = "[...TRACE...] ";
                break;
+            case AXIS2_LOG_LEVEL_SERVICE:
+                break;
            }
            fprintf(stderr, "%s %s(%d) %s\n", level_str, file, line, buffer);
        }
@@ -232,7 +241,7 @@

AXIS2_EXTERN void AXIS2_CALL
axutil_log_impl_write_to_file(
-    FILE * fd,
+    axutil_log_t * log,
    axutil_thread_mutex_t * mutex,
    axutil_log_levels_t level,
    const axis2_char_t * file,
@@ -240,6 +249,8 @@
    const axis2_char_t * value)
{
    const char *level_str = "";
+    axutil_log_impl_t *log_impl = AXIS2_INTF_TO_IMPL(log);
+    FILE *fd = NULL;

    /**
       * print all critical and error logs irrespective of log->level setting
@@ -265,8 +276,14 @@
    case AXIS2_LOG_LEVEL_TRACE:
        level_str = "[...TRACE...] ";
        break;
+    case AXIS2_LOG_LEVEL_SERVICE:
+        break;
    }
    axutil_thread_mutex_lock(mutex);
+
+    axutil_log_impl_rotate(log);
+    fd = log_impl->stream;
+ if (file)
        fprintf(fd, "[%s] %s%s(%d) %s\n", axutil_log_impl_get_time_str(),
                level_str, file, line, value);
@@ -277,6 +294,84 @@
    axutil_thread_mutex_unlock(mutex);
}

+static axis2_status_t
+axutil_log_impl_rotate(
+    axutil_log_t * log)
+{
+    long size = -1;
+    FILE *old_log_fd = NULL;
+    axis2_char_t old_log_file_name[AXUTIL_LOG_FILE_NAME_SIZE];
+    axutil_log_impl_t *log_impl = AXIS2_INTF_TO_IMPL(log);
+    if(log_impl->file_name)
+        size = axutil_file_handler_size(log_impl->file_name);
+ + if(size >= log->size)
+    {
+ AXIS2_SNPRINTF(old_log_file_name, AXUTIL_LOG_FILE_NAME_SIZE, "%s%s", + log_impl->file_name, ".old");
+        axutil_file_handler_close(log_impl->stream);
+        old_log_fd = axutil_file_handler_open(old_log_file_name, "w+");
+        log_impl->stream = axutil_file_handler_open(log_impl->file_name, "r");
+        if(old_log_fd && log_impl->stream)
+        {
+            axutil_file_handler_copy(log_impl->stream, old_log_fd);
+            axutil_file_handler_close(old_log_fd);
+            axutil_file_handler_close(log_impl->stream);
+            old_log_fd = NULL;
+            log_impl->stream = NULL;
+        }
+        if(old_log_fd)
+        {
+            axutil_file_handler_close(old_log_fd);
+        }
+        if(log_impl->stream)
+        {
+            axutil_file_handler_close(log_impl->stream);
+        }
+        log_impl->stream = axutil_file_handler_open(log_impl->file_name, "w+");
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+axutil_log_impl_log_service(
+    axutil_log_t * log,
+    const axis2_char_t * filename,
+    const int linenumber,
+    const axis2_char_t * format,
+    ...)
+{
+    FILE *fd = NULL;
+    axutil_thread_mutex_t *mutex = NULL;
+
+    if (log && format)
+    {
+
+        if (!(fd = AXIS2_INTF_TO_IMPL(log)->stream))
+        {
+            fprintf(stderr, "Stream is not found\n");
+        }
+
+        if (!(mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+        {
+            fprintf(stderr, "Log mutex is not found\n");
+
+        }
+        if (AXIS2_LOG_LEVEL_DEBUG <= log->level)
+        {
+            char value[AXIS2_LEN_VALUE + 1];
+            va_list ap;
+            va_start(ap, format);
+            AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+            va_end(ap);
+            axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_DEBUG,
+                filename, linenumber, value);
+        }
+    }
+    else
+        fprintf(stderr, "please check your log and buffer");
+}
+
AXIS2_EXTERN void AXIS2_CALL
axutil_log_impl_log_debug(
    axutil_log_t * log,
@@ -302,14 +397,15 @@

        }

-        if (AXIS2_LOG_LEVEL_DEBUG <= log->level)
+ if (AXIS2_LOG_LEVEL_DEBUG <= log->level && + log->level != AXIS2_LOG_LEVEL_SERVICE)
        {
            char value[AXIS2_LEN_VALUE + 1];
            va_list ap;
            va_start(ap, format);
            AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
            va_end(ap);
-            axutil_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_DEBUG,
+            axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_DEBUG,
                                          filename, linenumber, value);
        }
    }
@@ -340,15 +436,16 @@

        }

-        if (AXIS2_LOG_LEVEL_INFO <= log->level)
+        if (AXIS2_LOG_LEVEL_INFO <= log->level &&
+            log->level != AXIS2_LOG_LEVEL_SERVICE)
        {
            char value[AXIS2_LEN_VALUE + 1];
            va_list ap;
            va_start(ap, format);
            AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
            va_end(ap);
-            axutil_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_INFO, 
NULL,
-                                          -1, value);
+ axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_INFO, + NULL, -1, value);
        }
    }
    else
@@ -381,15 +478,16 @@

        }

-        if (AXIS2_LOG_LEVEL_WARNING <= log->level)
+        if (AXIS2_LOG_LEVEL_WARNING <= log->level &&
+            log->level != AXIS2_LOG_LEVEL_SERVICE)
        {
            char value[AXIS2_LEN_VALUE + 1];
            va_list ap;
            va_start(ap, format);
            AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
            va_end(ap);
-            axutil_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_WARNING,
-                                          filename, linenumber, value);
+ axutil_log_impl_write_to_file(log, mutex, + AXIS2_LOG_LEVEL_WARNING, filename, linenumber, value);
        }
    }
    else
@@ -427,7 +525,7 @@
        va_start(ap, format);
        AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
        va_end(ap);
-        axutil_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_ERROR,
+        axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_ERROR,
                                      filename, linenumber, value);
    }
    else
@@ -467,7 +565,7 @@
        va_start(ap, format);
        AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
        va_end(ap);
-        axutil_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_CRITICAL,
+        axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_CRITICAL,
                                      filename, linenumber, value);
    }
    else
@@ -520,6 +618,8 @@
    }

    axutil_thread_mutex_lock(log_impl->mutex);
+    log_impl->file_name = NULL;
+    log_impl->log.size = AXUTIL_LOG_FILE_SIZE;
    log_impl->stream = stderr;
    axutil_thread_mutex_unlock(log_impl->mutex);
    /* by default, log is enabled */
@@ -557,14 +657,15 @@

        }

-        if (AXIS2_LOG_LEVEL_TRACE <= log->level)
+        if (AXIS2_LOG_LEVEL_TRACE <= log->level &&
+            log->level != AXIS2_LOG_LEVEL_SERVICE)
        {
            char value[AXIS2_LEN_VALUE + 1];
            va_list ap;
            va_start(ap, format);
            AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
            va_end(ap);
-            axutil_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_TRACE,
+            axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_TRACE,
                                          filename, linenumber, value);
        }
    }



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




--
Samisa Abeysinghe - Apche Axis2/C
"http://ws.apache.org/axis2/c/?Apache&nbsp;Axis2/C&nbsp;The&nbsp;Web&nbsp;Services&nbsp;Engine";


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

Reply via email to