From 770a14c3af34099b859da8ee5be1991c3f75a0b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Fri, 2 Apr 2010 10:55:37 +0000 Subject: [PATCH] use different log category for notif interlogd --- org.glite.lb.logger/Makefile | 7 ++- org.glite.lb.logger/src/event_queue.c | 2 +- org.glite.lb.logger/src/event_store.c | 84 ++++++++++++++-------------- org.glite.lb.logger/src/il_master.c | 24 ++++---- org.glite.lb.logger/src/input_queue_socket.c | 2 +- org.glite.lb.logger/src/interlogd.c | 2 +- org.glite.lb.logger/src/interlogd.h | 2 + org.glite.lb.logger/src/queue_thread.c | 26 ++++----- org.glite.lb.logger/src/recover.c | 2 +- org.glite.lb.logger/src/send_event.c | 14 ++--- 10 files changed, 85 insertions(+), 80 deletions(-) diff --git a/org.glite.lb.logger/Makefile b/org.glite.lb.logger/Makefile index 7c1539f..608afbc 100644 --- a/org.glite.lb.logger/Makefile +++ b/org.glite.lb.logger/Makefile @@ -44,11 +44,13 @@ endif DEBUG:=-g -O0 CFLAGS:=${DEBUG} \ -I${stagedir}/include -I${top_srcdir}/src \ + -I${log4c_prefix}/include \ -D_GNU_SOURCE \ ${COVERAGE_FLAGS} \ ${VERSION} ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} LDFLAGS:=-L${stagedir}/${libdir} \ + -L${log4c_prefix}/lib \ ${COVERAGE_FLAGS} LINK:=libtool --mode=link ${CC} ${LDFLAGS} LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/${libdir} ${LDFLAGS} @@ -75,13 +77,13 @@ LOGD_OBJS:= logd_proto.o logd.o LOGD_NOBJS:=${LOGD_OBJS:.o=.no} INTERLOG_OBJS:=il_error.o input_queue_socket.o \ - recover.o send_event.o \ + recover.o send_event.o plugin_mgr.o \ event_queue.o event_store.o il_master.o interlogd.o \ queue_mgr.o server_msg.o queue_thread.o \ plugin_mgr.o WS_INTERLOG_OBJS:=il_error.o input_queue_socket_http.o \ - recover.o http.o send_event_http.o \ + recover.o http.o send_event_http.o plugin_mgr.o \ event_queue.o event_store_http.o il_master.o interlogd.o \ queue_mgr_http.o server_msg_http.o queue_thread.o @@ -103,6 +105,7 @@ INTERLOG_TEST_OBJS:= \ input_queue_socket.o \ input_queue_socketTest.o \ send_event.o \ + plugin_mgr. o \ event_queue.o \ event_queueTest.o \ IlTestBase.o \ diff --git a/org.glite.lb.logger/src/event_queue.c b/org.glite.lb.logger/src/event_queue.c index d3cd690..84e32df 100644 --- a/org.glite.lb.logger/src/event_queue.c +++ b/org.glite.lb.logger/src/event_queue.c @@ -352,7 +352,7 @@ event_queue_move_events(struct event_queue *eq_s, eq_s->tail = NULL; while(p) { if((*cmp_func)(p->msg, data)) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " moving event at offset %d(%d) from %s:%d to %s:%d", p->msg->offset, p->msg->generation, eq_s->dest_name, eq_s->dest_port, eq_d ? eq_d->dest_name : "trash", eq_d ? eq_d->dest_port : -1); diff --git a/org.glite.lb.logger/src/event_store.c b/org.glite.lb.logger/src/event_store.c index c12623e..7b62126 100644 --- a/org.glite.lb.logger/src/event_store.c +++ b/org.glite.lb.logger/src/event_store.c @@ -228,7 +228,7 @@ event_store_create(char *job_id_s, const char *filename) es->rotate_index = filename ? fname2index(filename) : 0; IL_EVENT_ID_FREE(job_id); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " creating event store for id %s, filename %s, rotate index %lld", job_id_s, es->event_file_name, es->rotate_index); @@ -371,7 +371,7 @@ event_store_quarantine(struct event_store *es) } /* actually rename the file */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " renaming damaged event file from %s to %s", es->event_file_name, newname); if(rename(es->event_file_name, newname) < 0) { @@ -436,7 +436,7 @@ event_store_rotate_file(struct event_store *es) } /* actually rename the file */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " renaming too large event file from %s to %s", es->event_file_name, newname); if(rename(es->event_file_name, newname) < 0) { @@ -563,7 +563,7 @@ event_store_recover(struct event_store *es) if(pthread_rwlock_wrlock(&es->offset_lock)) abort(); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " reading events from %s", es->event_file_name); @@ -601,7 +601,7 @@ event_store_recover(struct event_store *es) /* check the file modification time and size to avoid unnecessary operations */ memset(&stbuf, 0, sizeof(stbuf)); if(fstat(fd, &stbuf) < 0) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " could not stat event file %s: %s", es->event_file_name, strerror(errno)); fclose(ef); @@ -611,7 +611,7 @@ event_store_recover(struct event_store *es) return -1; } else { if((es->offset == stbuf.st_size) && (es->last_modified == stbuf.st_mtime)) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " event file not modified since last visit, skipping"); fclose(ef); event_store_unlock(es); @@ -646,11 +646,11 @@ event_store_recover(struct event_store *es) last = es->last_committed_bs; } - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " setting starting file position to %ld", last); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " bytes sent to logging server: %d", es->last_committed_ls); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " bytes sent to bookkeeping server: %d", es->last_committed_bs); if(last > 0) { @@ -671,7 +671,7 @@ event_store_recover(struct event_store *es) even if the offset points at EOF */ if((c=fgetc(ef)) != EVENT_SEPARATOR) { /* Houston, we have got a problem */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " file position %ld does not point at the beginning of event string, backing off!", last); /* now, where were we? */ @@ -723,7 +723,7 @@ event_store_recover(struct event_store *es) int r; /* fpos holds the starting position of event_s in file */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " reading event at %ld", fpos); last_ls = es->last_committed_ls; @@ -742,7 +742,7 @@ event_store_recover(struct event_store *es) free(event_s); } if(msg == NULL) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " event file corrupted! I will try to move it to quarantine (ie. rename it)."); /* actually do not bother if quarantine succeeded or not - we could not do more */ event_store_quarantine(es); @@ -755,7 +755,7 @@ event_store_recover(struct event_store *es) msg->generation = es->generation; #ifdef IL_NOTIFICATIONS - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, "message dest %s, last dest %s, known dest %s", msg->dest, last_dest, eq_b ? eq_b->dest : "none"); /* check message destination */ @@ -763,7 +763,7 @@ event_store_recover(struct event_store *es) /* the message does not have destination itself, use destination cached for notification id */ if(eq_b == NULL) { /* no destination is known for notification id, commit it immediately */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " message has no known destination, will not be sent"); event_store_commit(es, msg->ev_len, 0, msg->generation); } @@ -793,7 +793,7 @@ event_store_recover(struct event_store *es) /* first enqueue to the LS */ if(!bs_only && (last >= last_ls)) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " queuing event at %ld to logging server", last); /* TODO: throttling for the log server queue? */ @@ -810,10 +810,10 @@ event_store_recover(struct event_store *es) break; } else if(r > 0) { throttle = 1; - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " queue max length limit reached, event at %ld throttled", fpos); } else { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " queuing event at %ld to bookkeeping server", last); } } @@ -833,7 +833,7 @@ event_store_recover(struct event_store *es) #if defined(IL_NOTIFICATIONS) /* check if we have to move events to new destination */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " last destination %s, last known destination %s", last_dest, eq_b ? eq_b->dest : "none"); if(last_dest && strcmp(last_dest, eq_b->dest)) { @@ -847,7 +847,7 @@ event_store_recover(struct event_store *es) /* move all events with this notif_id from eq_b to eq_dest */ event_queue_move_events(eq_b, eq_dest, cmp_jobid, es->job_id_s); eq_b = eq_dest; - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " all messages for notif id %s are now destined to %s", es->job_id_s, eq_b->dest); if(event_queue_create_thread(eq_b) < 0) { @@ -878,14 +878,14 @@ event_store_recover(struct event_store *es) es->offset = last; es->last_modified = stbuf.st_mtime; - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " event store offset set to %ld", last); if(msg) server_msg_free(msg); fclose(ef); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " finished reading events with %d", ret); if(pthread_rwlock_unlock(&es->offset_lock)) @@ -993,18 +993,18 @@ event_store_clean(struct event_store *es) /* prevent sender threads from updating */ event_store_lock(es); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " trying to cleanup event store %s", es->job_id_s); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " bytes sent to logging server: %d", es->last_committed_ls); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " bytes sent to bookkeeping server: %d", es->last_committed_bs); /* preliminary check to avoid opening event file */ /* if the positions differ, some events still have to be sent */ if(es->last_committed_ls != es->last_committed_bs) { event_store_unlock(es); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " not all events sent, cleanup aborted"); return(0); } @@ -1023,7 +1023,7 @@ event_store_clean(struct event_store *es) event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) abort(); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " event_store_clean: error opening event file: %s", strerror(errno)); return(1); } @@ -1036,7 +1036,7 @@ event_store_clean(struct event_store *es) efl.l_start = 0; efl.l_len = 0; if(fcntl(fd, F_SETLK, &efl) < 0) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " could not lock event file, cleanup aborted"); fclose(ef); event_store_unlock(es); @@ -1062,7 +1062,7 @@ event_store_clean(struct event_store *es) } last = ftell(ef); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " total bytes in file: %d", last); if(es->last_committed_ls < last) { @@ -1070,11 +1070,11 @@ event_store_clean(struct event_store *es) event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) abort(); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " events still waiting in queue, cleanup aborted"); return(0); } else if( es->last_committed_ls > last) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " warning: event file seems to shrink!"); /* XXX - in that case we can not continue because there may be some undelivered events referring to that event store */ @@ -1086,7 +1086,7 @@ event_store_clean(struct event_store *es) } /* now we are sure that all events were sent and the event queues are empty */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " removing event file %s", es->event_file_name); /* remove the event file */ @@ -1235,7 +1235,7 @@ event_store_release(struct event_store *es) if(pthread_rwlock_unlock(&es->use_lock)) abort(); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " released lock on %s (%s)", es->job_id_s, es->event_file_name); return(0); } @@ -1254,11 +1254,11 @@ event_store_from_file(char *filename) edg_wll_Context context; #endif - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " attaching to event file: %s", filename); if(strstr(filename, "quarantine") != NULL) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " file name belongs to quarantine, not touching that."); + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " file name belongs to quarantine, not touching that."); return(0); } @@ -1303,10 +1303,10 @@ event_store_from_file(char *filename) #else job_id_s = edg_wll_GetJobId(event_s); #endif - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " event id: '%s'", job_id_s); if(job_id_s == NULL) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " skipping file, could not parse event"); ret = 0; goto out; @@ -1455,10 +1455,10 @@ event_store_init(char *prefix) } else { /* could not stat file, remove ctl */ strcat(ef, s); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " removing stale file %s", ef); if(unlink(ef)) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " could not remove file %s: %s\n", ef, strerror(errno)); } @@ -1490,7 +1490,7 @@ event_store_recover_all() /* recover this event store */ /* no need to lock use_lock in event_store, the store_list_lock is in place */ if(event_store_recover(sl->es) < 0) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " error recovering event store %s: %s", sl->es->event_file_name, error_get_msg()); clear_error(); @@ -1515,7 +1515,7 @@ event_store_remove(struct event_store *es) switch(event_store_clean(es)) { case 0: - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " event store not removed, still used"); return(0); @@ -1576,7 +1576,7 @@ event_store_cleanup() /* one event store at time */ ret = pthread_rwlock_trywrlock(&sl->es->use_lock); if(ret == EBUSY) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " event_store %s is in use by another thread", sl->es->job_id_s); sl = slnext; @@ -1599,7 +1599,7 @@ event_store_cleanup() break; case -1: - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " error removing event store %s (file %s): %s", sl->es->job_id_s, sl->es->event_file_name, error_get_msg()); /* event_store_release(sl->es); */ diff --git a/org.glite.lb.logger/src/il_master.c b/org.glite.lb.logger/src/il_master.c index 2ea66b1..2cc1018 100644 --- a/org.glite.lb.logger/src/il_master.c +++ b/org.glite.lb.logger/src/il_master.c @@ -101,7 +101,7 @@ parse_cmd(char *event, char **job_id_s, long *receipt, int *timeout) #if defined(INTERLOGD_FLUSH) if(strcmp(++r, "\"flush\"")) { #endif - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, "command %s not implemented", + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, "command %s not implemented", r); ret = -1; continue; @@ -150,7 +150,7 @@ handle_cmd(il_octet_string_t *event, long offset) return(0); #if defined(INTERLOGD_FLUSH) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, "received FLUSH command"); + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, "received FLUSH command"); /* catchup with all neccessary event files */ if(job_id_s) { @@ -164,7 +164,7 @@ handle_cmd(il_octet_string_t *event, long offset) no need to lock the event_store at all */ event_store_release(es); if(result < 0) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " error trying to catch up with event file: %s", error_get_msg()); clear_error(); @@ -173,7 +173,7 @@ handle_cmd(il_octet_string_t *event, long offset) /* this call does not fail :-) */ event_store_recover_all(); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " alerting threads to report status"); + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " alerting threads to report status"); /* prevent threads from reporting too early */ if(pthread_mutex_lock(&flush_lock) < 0) { @@ -229,7 +229,7 @@ handle_cmd(il_octet_string_t *event, long offset) while(num_replies < num_threads) { int ret; if((ret=pthread_cond_timedwait(&flush_cond, &flush_lock, &endtime)) < 0) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " error waiting for thread reply: %s", strerror(errno)); result = (ret == ETIMEDOUT) ? 0 : -1; @@ -259,7 +259,7 @@ handle_cmd(il_octet_string_t *event, long offset) if(eq->flushing == 2) { eq->flushing = 0; num_replies++; - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " thread reply: %d", eq->flush_result); result = ((result == 1) || (eq->flush_result < 0)) ? @@ -300,7 +300,7 @@ handle_cmd(il_octet_string_t *event, long offset) if(job_id_s) free(job_id_s); result = send_confirmation(receipt, result); if(result <= 0) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, "handle_cmd: error sending status: %s", error_get_msg()); return(1); @@ -331,7 +331,7 @@ handle_msg(il_octet_string_t *event, long offset) /* convert event to message for server */ if((msg = server_msg_create(event, offset)) == NULL) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " handle_msg: error parsing event '%s': %s", event, error_get_msg()); return(0); @@ -353,7 +353,7 @@ handle_msg(il_octet_string_t *event, long offset) il_log(LOG_DEBUG, " syncing event store at %d with event at %d, result %d\n", es->offset, offset, ret); */ if(ret < 0) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " handle_msg: error syncing event store: %s", error_get_msg()); /* XXX should error during event store recovery cause us to drop the message? */ @@ -379,7 +379,7 @@ handle_msg(il_octet_string_t *event, long offset) eq_s = queue_list_get(msg->job_id_s); #endif if(eq_s == NULL) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, " handle_msg: apropriate queue not found: %s", error_get_msg()); clear_error(); @@ -432,7 +432,7 @@ loop() if((ret = input_queue_get(&msg, &offset, INPUT_TIMEOUT)) < 0) { if(error_get_maj() == IL_PROTO) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " premature EOF while receiving event"); /* problems with socket input, try to catch up from files */ #ifndef PERF_EMPTY @@ -465,7 +465,7 @@ loop() return (ret); break; default: - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, "Error: %s", error_get_msg()); break; diff --git a/org.glite.lb.logger/src/input_queue_socket.c b/org.glite.lb.logger/src/input_queue_socket.c index f7b60ab..ffcca81 100644 --- a/org.glite.lb.logger/src/input_queue_socket.c +++ b/org.glite.lb.logger/src/input_queue_socket.c @@ -260,7 +260,7 @@ input_queue_get(il_octet_string_t **buffer, long *offset, int timeout) case -1: /* error */ switch(errno) { case EINTR: - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " interrupted while waiting for event!"); return(0); diff --git a/org.glite.lb.logger/src/interlogd.c b/org.glite.lb.logger/src/interlogd.c index b7219ad..f1afa5a 100644 --- a/org.glite.lb.logger/src/interlogd.c +++ b/org.glite.lb.logger/src/interlogd.c @@ -394,7 +394,7 @@ void do_handle_signal() { glite_common_log_priority_to_string(glite_common_log_get_priority(LOG_CATEGORY_LB)), LOG_CATEGORY_LB, glite_common_log_priority_to_string(glite_common_log_get_priority(LOG_CATEGORY_LB_IL)), - LOG_CATEGORY_LB_IL); + IL_LOG_CATEGORY); break; case SIGPIPE: diff --git a/org.glite.lb.logger/src/interlogd.h b/org.glite.lb.logger/src/interlogd.h index 60ddd7b..56bccec 100644 --- a/org.glite.lb.logger/src/interlogd.h +++ b/org.glite.lb.logger/src/interlogd.h @@ -64,6 +64,7 @@ extern "C" { #define IL_EVENT_GET_UNIQUE(a) edg_wll_NotifIdGetUnique((a)) #define IL_EVENT_ID_FREE(a) edg_wll_NotifIdFree((a)) #define IL_EVENT_ID_PARSE(a,b) edg_wll_NotifIdParse((a),(b)) +#define IL_LOG_CATEGORY LOG_CATEGORY_LB_ILNOTIF #else @@ -74,6 +75,7 @@ extern "C" { #define IL_EVENT_GET_UNIQUE(a) edg_wlc_JobIdGetUnique((a)) #define IL_EVENT_ID_FREE(a) edg_wlc_JobIdFree((a)) #define IL_EVENT_ID_PARSE(a,b) edg_wlc_JobIdParse((a),(b)) +#define IL_LOG_CATEGORY LOG_CATEGORY_IL_LB #endif diff --git a/org.glite.lb.logger/src/queue_thread.c b/org.glite.lb.logger/src/queue_thread.c index bc72ae1..ebcb820 100644 --- a/org.glite.lb.logger/src/queue_thread.c +++ b/org.glite.lb.logger/src/queue_thread.c @@ -96,7 +96,7 @@ queue_thread(void *q) ret = event_queue_wait(eq, close_timeout); if(ret == 1) {/* timeout? */ (*eq->event_queue_close)(eq); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " connection to %s closed", eq->dest); } @@ -129,27 +129,27 @@ queue_thread(void *q) event_queue_cond_unlock(eq); /* discard expired events */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " discarding expired events"); + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " discarding expired events"); now = time(NULL); event_queue_move_events(eq, NULL, cmp_expires, &now); if(!event_queue_empty(eq)) { /* deliver pending events */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " attempting delivery to %s", eq->dest); /* connect to server */ if((ret=(*eq->event_queue_connect)(eq)) == 0) { /* not connected */ if(error_get_maj() != IL_OK) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, "queue_thread: %s", error_get_msg()); #if defined(IL_NOTIFICATIONS) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " could not connect to client %s, waiting for retry", eq->dest); #else - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO, " could not connect to bookkeeping server %s, waiting for retry", eq->dest); #endif @@ -162,23 +162,23 @@ queue_thread(void *q) case 0: /* there was an error and we still have events to send */ if(error_get_maj() != IL_OK) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, "queue_thread: %s", error_get_msg()); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " events still waiting"); break; case 1: /* hey, we are done for now */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " all events for %s sent", eq->dest); break; default: /* internal error */ - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, "queue_thread: %s", error_get_msg()); exit = 1; @@ -191,7 +191,7 @@ queue_thread(void *q) close_timeout = default_close_timeout; else { (*eq->event_queue_close)(eq); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " connection to %sclosed", eq->dest); } @@ -205,7 +205,7 @@ queue_thread(void *q) /* Check if we are flushing and if we are, report status to master */ if(eq->flushing == 1) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " flushing mode detected, reporting status"); /* 0 - events waiting, 1 - events sent, < 0 - some error */ eq->flush_result = ret; @@ -224,7 +224,7 @@ queue_thread(void *q) which may cure server kicking us out after given number of connections */ #ifndef LB_PERF if((ret == 0) && (retrycnt > 0)) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " sleeping"); event_queue_sleep(eq); } diff --git a/org.glite.lb.logger/src/recover.c b/org.glite.lb.logger/src/recover.c index 716f4c7..250a40a 100644 --- a/org.glite.lb.logger/src/recover.c +++ b/org.glite.lb.logger/src/recover.c @@ -38,7 +38,7 @@ recover_thread(void *q) } while(1) { - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, "Looking up event files."); if(event_store_init(file_prefix) < 0) { glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, diff --git a/org.glite.lb.logger/src/send_event.c b/org.glite.lb.logger/src/send_event.c index a263c85..b48ab23 100644 --- a/org.glite.lb.logger/src/send_event.c +++ b/org.glite.lb.logger/src/send_event.c @@ -75,7 +75,7 @@ send_confirmation(long lllid, int code) } ret = 1; - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " sent code %d back to client", code); @@ -205,7 +205,7 @@ event_queue_connect(struct event_queue *eq) if(pthread_mutex_unlock(&cred_handle_lock) < 0) abort(); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " trying to connect to %s:%d", eq->dest_name, eq->dest_port); ret = edg_wll_gss_connect(local_cred_handle->creds, eq->dest_name, eq->dest_port, &tv, &eq->gss, &gss_stat); @@ -216,7 +216,7 @@ event_queue_connect(struct event_queue *eq) if(local_cred_handle != cred_handle && local_cred_handle->counter == 0) { edg_wll_gss_release_cred(&local_cred_handle->creds, NULL); free(local_cred_handle); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " freed credentials, not used anymore"); + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " freed credentials, not used anymore"); } if(pthread_mutex_unlock(&cred_handle_lock) < 0) abort(); @@ -297,7 +297,7 @@ event_queue_send(struct event_queue *eq) if(event_queue_get(eq, &msg) < 0) return(-1); - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " trying to deliver event at offset %d for job %s", msg->offset, msg->job_id_s); @@ -324,7 +324,7 @@ event_queue_send(struct event_queue *eq) eq->timeout = 1; } else { eq->timeout = TIMEOUT; - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, " error reading server %s reply: %s", + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_WARN, " error reading server %s reply: %s", eq->dest_name, error_get_msg()); } return(0); @@ -339,7 +339,7 @@ event_queue_send(struct event_queue *eq) } #endif - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_DEBUG, " event sent, server %s replied with %d, %s", eq->dest_name, code, rep); free(rep); @@ -376,7 +376,7 @@ event_queue_send(struct event_queue *eq) if((ret == 0) && (error_get_maj() != IL_OK)) - glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_ERROR, "send_event: %s", error_get_msg()); -- 1.8.2.3