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/10 05:29:56 UTC
svn commit: r376540 - in /webservices/axis2/trunk/c: include/axis2_log.h
modules/core/engine/engine.c
modules/core/transport/http/server/http_server_main.c modules/util/log.c
Author: samisa
Date: Thu Feb 9 20:29:54 2006
New Revision: 376540
URL: http://svn.apache.org/viewcvs?rev=376540&view=rev
Log:
Added trace loging support to help enable trace with a compiler option
Modified:
webservices/axis2/trunk/c/include/axis2_log.h
webservices/axis2/trunk/c/modules/core/engine/engine.c
webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c
webservices/axis2/trunk/c/modules/util/log.c
Modified: webservices/axis2/trunk/c/include/axis2_log.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_log.h?rev=376540&r1=376539&r2=376540&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_log.h (original)
+++ webservices/axis2/trunk/c/include/axis2_log.h Thu Feb 9 20:29:54 2006
@@ -64,7 +64,9 @@
/** Info level, logs information */
AXIS2_LOG_LEVEL_INFO,
/** Debug level, logs everything */
- AXIS2_LOG_LEVEL_DEBUG
+ AXIS2_LOG_LEVEL_DEBUG,
+ /** Trace level, Enable with compiler time option AXIS2_TRACE */
+ AXIS2_LOG_LEVEL_TRACE
} axis2_log_levels_t;
@@ -96,13 +98,6 @@
* @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE
*/
axis2_status_t (AXIS2_CALL *write) (axis2_log_t *log, const axis2_char_t *buffer, axis2_log_levels_t level,const axis2_char_t *file,const int line);
- /*
- axis2_status_t (AXIS2_CALL *log_critical) (struct axis2_log *log,const char *filename,const int linenumber,axis2_char_t *format,...);
- axis2_status_t (AXIS2_CALL *log_error) (struct axis2_log *log,const char *filename,const int linenumber,axis2_char_t *format,...);
- axis2_status_t (AXIS2_CALL *log_warning) (struct axis2_log *log,const char *filename,const int linenumber,axis2_char_t *format,...);
- axis2_status_t (AXIS2_CALL *log_info) (struct axis2_log *log, axis2_char_t *format, ...);
- axis2_status_t (AXIS2_CALL *log_debug) (struct axis2_log *log,const char *filename,const int linenumber,axis2_char_t *format,...);
- */
};
/**
@@ -114,8 +109,6 @@
{
/** Log related ops */
struct axis2_log_ops *ops;
-
- /*FILE *log;*/
/** Log level */
axis2_log_levels_t level;
/** Is logging enabled? */
@@ -132,6 +125,7 @@
AXIS2_DECLARE(axis2_status_t) axis2_log_impl_log_info(axis2_log_t *log, const axis2_char_t *format,...);
AXIS2_DECLARE(axis2_status_t) axis2_log_impl_log_debug(axis2_log_t *log,const axis2_char_t *filename,const int linenumber,const axis2_char_t *format,...);
+AXIS2_DECLARE(axis2_status_t) axis2_log_impl_log_trace(axis2_log_t *log,const axis2_char_t *filename,const int linenumber,const axis2_char_t *format,...);
#define AXIS2_LOG_FREE(allocator, log) ((log->ops)->free(allocator, log))
@@ -143,6 +137,12 @@
#define AXIS2_LOG_WARNING axis2_log_impl_log_warning
#define AXIS2_LOG_ERROR axis2_log_impl_log_error
#define AXIS2_LOG_CRITICAL axis2_log_impl_log_critical
+
+#ifdef AXIS2_TRACE
+#define AXIS2_LOG_TRACE axis2_log_impl_log_trace
+#else
+#define AXIS2_LOG_TRACE(params, args ...)
+#endif
/** @} */
Modified: webservices/axis2/trunk/c/modules/core/engine/engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/engine.c?rev=376540&r1=376539&r2=376540&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/engine.c Thu Feb 9 20:29:54 2006
@@ -145,6 +145,8 @@
axis2_conf_ctx_t *conf_ctx = NULL;
axis2_conf_t *conf = NULL;
+ AXIS2_LOG_TRACE((*env)->log, AXIS2_LOG_SI, "axis2_engine_send start");
+
AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
@@ -229,6 +231,7 @@
}
AXIS2_LOG_DEBUG((*env)->log, AXIS2_LOG_SI, "Axis2 engine send successful");
+ AXIS2_LOG_TRACE((*env)->log, AXIS2_LOG_SI, "axis2_engine_send end");
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c?rev=376540&r1=376539&r2=376540&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c Thu Feb 9 20:29:54 2006
@@ -81,8 +81,8 @@
log_level = atoi(optarg);
if (log_level < AXIS2_LOG_LEVEL_CRITICAL)
log_level = AXIS2_LOG_LEVEL_CRITICAL;
- if (log_level > AXIS2_LOG_LEVEL_DEBUG)
- log_level = AXIS2_LOG_LEVEL_CRITICAL;
+ if (log_level > AXIS2_LOG_LEVEL_TRACE)
+ log_level = AXIS2_LOG_LEVEL_TRACE;
break;
case 'f':
log_file = optarg;
@@ -157,7 +157,7 @@
"SOCKET_READ_TIMEOUT. Default timeout is 30 seconds\n");
fprintf(stdout, "\t-l LOG_LEVEL\t set log level to LOG_LEVEL. Available "
"log levels range from 0(critical only) to 4(debug)."
- "\n\t\t\t Default log level is 4(debug)\n");
+ "\n\t\t\t Default log level is 4(debug).\n");
fprintf(stdout, "\t-f LOG_FILE\t set log file to LOG_FILE. Default is /dev/stderr\n");
fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
}
Modified: webservices/axis2/trunk/c/modules/util/log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/log.c?rev=376540&r1=376539&r2=376540&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/log.c (original)
+++ webservices/axis2/trunk/c/modules/util/log.c Thu Feb 9 20:29:54 2006
@@ -107,13 +107,6 @@
}
log_impl->log.ops->free = axis2_log_impl_free;
log_impl->log.ops->write = axis2_log_impl_write;
- /*
- log_impl->log.ops->log_critical = axis2_log_impl_log_critical;
- log_impl->log.ops->log_error = axis2_log_impl_log_error;
- log_impl->log.ops->log_warning = axis2_log_impl_log_warning;
- log_impl->log.ops->log_info = axis2_log_impl_log_info;
- log_impl->log.ops->log_debug = axis2_log_impl_log_debug;
- */
}
return &(log_impl->log);
@@ -146,6 +139,9 @@
case AXIS2_LOG_LEVEL_DEBUG:
level_str = "[debug] ";
break;
+ case AXIS2_LOG_LEVEL_TRACE:
+ level_str = "[trace] ";
+ break;
}
fprintf(stderr,"%s %s(%d) %s\n", level_str, file, line, buffer);
}
@@ -182,6 +178,9 @@
case AXIS2_LOG_LEVEL_DEBUG:
level_str = "[debug] ";
break;
+ case AXIS2_LOG_LEVEL_TRACE:
+ level_str = "[trace] ";
+ break;
}
if (file)
fprintf(fd,"[%s] %s%s(%d) %s\n", axis2_log_impl_get_time_str(), level_str, file, line, value);
@@ -338,3 +337,32 @@
}
return time_str;
}
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_log_impl_log_trace(axis2_log_t *log, const axis2_char_t *filename,
+ const int linenumber, const axis2_char_t *format,...)
+{
+ FILE *fd = NULL;
+
+ if (!log || !format)
+ return -1;
+
+ if (!log->enabled)
+ return -1;
+
+ if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+ return -1;
+
+ if (AXIS2_LOG_LEVEL_TRACE <= 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);
+ axis2_log_impl_write_to_file(fd, AXIS2_LOG_LEVEL_TRACE, filename,
+ linenumber, value);
+ }
+ return 0;
+}
+