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 sa...@apache.org on 2006/02/09 05:27:10 UTC

svn commit: r376182 - in /webservices/axis2/trunk/c/modules/util: axis2_log_default.h log.c

Author: sahan
Date: Wed Feb  8 20:27:09 2006
New Revision: 376182

URL: http://svn.apache.org/viewcvs?rev=376182&view=rev
Log:
time stamp prefix to the log messages

Modified:
    webservices/axis2/trunk/c/modules/util/axis2_log_default.h
    webservices/axis2/trunk/c/modules/util/log.c

Modified: webservices/axis2/trunk/c/modules/util/axis2_log_default.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/axis2_log_default.h?rev=376182&r1=376181&r2=376182&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/axis2_log_default.h (original)
+++ webservices/axis2/trunk/c/modules/util/axis2_log_default.h Wed Feb  8 20:27:09 2006
@@ -45,6 +45,7 @@
     */
     AXIS2_DECLARE(axis2_log_t *) axis2_log_create (axis2_allocator_t * allocator,
                      axis2_log_ops_t * ops, axis2_char_t * stream_name);
+    AXIS2_DECLARE(axis2_char_t *) axis2_log_impl_get_time_str(void);
 
 /** @} */
     

Modified: webservices/axis2/trunk/c/modules/util/log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/log.c?rev=376182&r1=376181&r2=376182&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/log.c (original)
+++ webservices/axis2/trunk/c/modules/util/log.c Wed Feb  8 20:27:09 2006
@@ -184,9 +184,9 @@
             break;
     }
     if (file)
-    	fprintf(fd,"%s %s(%d) %s\n", level_str, file, line, value);
+    	fprintf(fd,"[%s] %s%s(%d) %s\n", axis2_log_impl_get_time_str(), level_str, file, line, value);
     else
-    	fprintf(fd,"%s %s\n", level_str, value);
+    	fprintf(fd,"[%s] %s %s\n", axis2_log_impl_get_time_str(), level_str, value);
 	fflush(fd);
 	return 0;
 }
@@ -319,4 +319,21 @@
 	axis2_log_impl_write_to_file(fd, AXIS2_LOG_LEVEL_CRITICAL, filename, 
 						linenumber, value);
 	return 0;
+}
+
+AXIS2_DECLARE(axis2_char_t *)
+axis2_log_impl_get_time_str(void)
+{
+    time_t tp;
+    tp = time(&tp);
+    char *time_str = ctime(&tp);
+    if(NULL == time_str)
+    {
+        return NULL;;
+    }
+    if('\n' == time_str[strlen(time_str)-1])
+    {
+       time_str[strlen(time_str)-1] = '\0';
+    }
+    return time_str;
 }