v2:
Rebased.
Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
---
std_indication.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/std_indication.c b/std_indication.c
index f9dbea4..21df1f5 100644
--- a/std_indication.c
+++ b/std_indication.c
@@ -141,7 +141,12 @@ static CMPIStatus raise(struct std_indication_ctx *ctx,
enabled = is_ind_enabled(ctx, ind_name, &s);
if (s.rc != CMPI_RC_OK) {
- CU_DEBUG("Problem checking enabled: '%s'",
CMGetCharPtr(s.msg));
+ if (s.msg != NULL) {
+ CU_DEBUG("Problem checking enabled: '%s'",
+ CMGetCharPtr(s.msg));
+ } else {
+ CU_DEBUG("Problem checking enabled, msg is NULL");
+ }
goto out;
}
@@ -176,7 +181,12 @@ CMPIStatus stdi_deliver(const CMPIBroker *broker,
enabled = is_ind_enabled(args->_ctx, ind_name, &s);
if (s.rc != CMPI_RC_OK) {
- CU_DEBUG("Problem checking enabled: '%s'",
CMGetCharPtr(s.msg));
+ if (s.msg != NULL) {
+ CU_DEBUG("Problem checking enabled: '%s'",
+ CMGetCharPtr(s.msg));
+ } else {
+ CU_DEBUG("Problem checking enabled, msg is NULL");
+ }
goto out;
}
--
1.7.1
Show replies by date
On server we need these information to debug eaiser.
v2:
format adjusted.
Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
---
debug_util.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/debug_util.c b/debug_util.c
index 2912fb6..0820b9f 100644
--- a/debug_util.c
+++ b/debug_util.c
@@ -23,6 +23,9 @@
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <time.h>
#include "libcmpiutil.h"
@@ -32,6 +35,15 @@ static FILE *log = NULL;
void debug_print(char *fmt, ...)
{
char *log_file = NULL;
+ pthread_t id = pthread_self();
+ struct timeval tv;
+ struct timezone tz;
+ gettimeofday(&tv, &tz);
+ time_t timep;
+ struct tm *p;
+ time(&timep);
+ p=localtime(&timep);
+
va_list ap;
va_start(ap, fmt);
@@ -49,8 +61,12 @@ void debug_print(char *fmt, ...)
log_init = 1;
}
- if (log != NULL)
+ if (log != NULL) {
+ fprintf(log, "[%d-%02d-%02d %02d:%02d:%02d.%06d] [%ld]: ",
+ (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, p->tm_hour,
+ p->tm_min, p->tm_sec, (int)tv.tv_usec, id);
vfprintf(log, fmt, ap);
+ }
va_end(ap);
}
--
1.7.1