From: Michal Voců Date: Fri, 17 Jul 2009 19:31:06 +0000 (+0000) Subject: rewrite to using log4c X-Git-Tag: gridsite-core_R_1_7_4~9 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=7aedc81dedc2794fe48a93a1150497f8d338678a;p=jra1mw.git rewrite to using log4c --- diff --git a/org.glite.lb.logger/src/event_queue.c b/org.glite.lb.logger/src/event_queue.c index 3d537d9..8e1588d 100644 --- a/org.glite.lb.logger/src/event_queue.c +++ b/org.glite.lb.logger/src/event_queue.c @@ -305,8 +305,9 @@ event_queue_move_events(struct event_queue *eq_s, eq_s->tail = NULL; while(p) { if((*cmp_func)(p->msg, data)) { - il_log(LOG_DEBUG, " moving event at offset %d(%d) from %s:%d to %s:%d\n", - p->msg->offset, p->msg->generation, eq_s->dest_name, eq_s->dest_port, + glite_common_log(LOG_CATEGORY_LB_IL, 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); /* il_log(LOG_DEBUG, " current: %x, next: %x\n", p, p->prev); */ /* remove the message from the source list */ diff --git a/org.glite.lb.logger/src/event_store.c b/org.glite.lb.logger/src/event_store.c index 88cabe4..4d6d0ef 100644 --- a/org.glite.lb.logger/src/event_store.c +++ b/org.glite.lb.logger/src/event_store.c @@ -213,8 +213,9 @@ event_store_create(char *job_id_s, const char *filename) es->rotate_index = filename ? fname2index(filename) : 0; IL_EVENT_ID_FREE(job_id); - il_log(LOG_DEBUG, " creating event store for id %s, filename %s, rotate index %lld\n", - job_id_s, es->event_file_name, es->rotate_index); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " creating event store for id %s, filename %s, rotate index %lld", + job_id_s, es->event_file_name, es->rotate_index); if(pthread_rwlock_init(&es->commit_lock, NULL)) abort(); @@ -368,8 +369,9 @@ event_store_quarantine(struct event_store *es) } /* actually rename the file */ - il_log(LOG_DEBUG, " renaming damaged event file from %s to %s\n", - es->event_file_name, newname); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + " renaming damaged event file from %s to %s", + es->event_file_name, newname); if(rename(es->event_file_name, newname) < 0) { set_error(IL_SYS, errno, "event_store_quarantine: error renaming event file"); return(-1); @@ -432,8 +434,9 @@ event_store_rotate_file(struct event_store *es) } /* actually rename the file */ - il_log(LOG_DEBUG, " renaming too large event file from %s to %s\n", - es->event_file_name, newname); + glite_common_log(LOG_CATEGORY_LB_IL, 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) { set_error(IL_SYS, errno, "event_store_rotate_file: error renaming event file"); return(-1); @@ -556,7 +559,9 @@ event_store_recover(struct event_store *es) if(pthread_rwlock_wrlock(&es->offset_lock)) abort(); - il_log(LOG_DEBUG, " reading events from %s\n", es->event_file_name); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " reading events from %s", + es->event_file_name); /* open event file */ ef = fopen(es->event_file_name, "r"); @@ -592,7 +597,9 @@ 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) { - il_log(LOG_ERR, " could not stat event file %s: %s\n", es->event_file_name, strerror(errno)); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " could not stat event file %s: %s", + es->event_file_name, strerror(errno)); fclose(ef); event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) @@ -600,7 +607,8 @@ event_store_recover(struct event_store *es) return -1; } else { if((es->offset == stbuf.st_size) && (es->last_modified == stbuf.st_mtime)) { - il_log(LOG_DEBUG, " event file not modified since last visit, skipping\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " event file not modified since last visit, skipping"); fclose(ef); event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) @@ -634,9 +642,12 @@ event_store_recover(struct event_store *es) last = es->last_committed_bs; } - il_log(LOG_DEBUG, " setting starting file position to %ld\n", last); - il_log(LOG_DEBUG, " bytes sent to logging server: %d\n", es->last_committed_ls); - il_log(LOG_DEBUG, " bytes sent to bookkeeping server: %d\n", es->last_committed_bs); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " setting starting file position to %ld", last); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " bytes sent to logging server: %d", es->last_committed_ls); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " bytes sent to bookkeeping server: %d", es->last_committed_bs); if(last > 0) { int c; @@ -656,9 +667,9 @@ 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 */ - il_log(LOG_WARNING, - " file position %ld does not point at the beginning of event string, backing off!\n", - last); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + " file position %ld does not point at the beginning of event string, backing off!", + last); /* now, where were we? */ if(es->offset) { /* next try will be with @@ -708,7 +719,8 @@ event_store_recover(struct event_store *es) int r; /* fpos holds the starting position of event_s in file */ - il_log(LOG_DEBUG, " reading event at %ld\n", fpos); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " reading event at %ld", fpos); last_ls = es->last_committed_ls; last_bs = es->last_committed_bs; @@ -726,7 +738,8 @@ event_store_recover(struct event_store *es) free(event_s); } if(msg == NULL) { - il_log(LOG_ALERT, " event file corrupted! I will try to move it to quarantine (ie. rename it).\n"); + glite_common_log(LOG_CATEGORY_LB_IL, 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); fclose(ef); @@ -738,14 +751,16 @@ event_store_recover(struct event_store *es) msg->generation = es->generation; #ifdef IL_NOTIFICATIONS - il_log(LOG_DEBUG, "DEBUG: message dest %s, last dest %s, known dest %s\n", - msg->dest, last_dest, eq_b ? eq_b->dest : "none"); + glite_common_log(LOG_CATEGORY_LB_IL, 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 */ if(msg->dest == NULL) { /* 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 */ - il_log(LOG_DEBUG, " message has no known destination, will not be sent\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " message has no known destination, will not be sent"); event_store_commit(es, msg->ev_len, 0, msg->generation); } } else { @@ -774,7 +789,8 @@ event_store_recover(struct event_store *es) /* first enqueue to the LS */ if(!bs_only && (last >= last_ls)) { - il_log(LOG_DEBUG, " queuing event at %ld to logging server\n", last); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " queuing event at %ld to logging server", last); /* TODO: throttling for the log server queue? */ if(enqueue_msg(eq_l, msg) < 0) { @@ -790,9 +806,11 @@ event_store_recover(struct event_store *es) break; } else if(r > 0) { throttle = 1; - il_log(LOG_DEBUG, " queue max length limit reached, event at %ld throttled\n", fpos); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + " queue max length limit reached, event at %ld throttled", fpos); } else { - il_log(LOG_DEBUG, " queuing event at %ld to bookkeeping server\n", last); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " queuing event at %ld to bookkeeping server", last); } } server_msg_free(msg); @@ -811,7 +829,9 @@ event_store_recover(struct event_store *es) #if defined(IL_NOTIFICATIONS) /* check if we have to move events to new destination */ - il_log(LOG_DEBUG, " last destination %s, last known destination %s\n", last_dest, eq_b ? eq_b->dest : "none"); + glite_common_log(LOG_CATEGORY_LB_IL, 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)) { struct event_queue *eq_dest = queue_list_get(last_dest); @@ -823,7 +843,8 @@ 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; - il_log(LOG_DEBUG, " all messages for notif id %s are now destined to %s\n", + glite_common_log(LOG_CATEGORY_LB_IL, 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) { ret = -1; @@ -853,13 +874,15 @@ event_store_recover(struct event_store *es) es->offset = last; es->last_modified = stbuf.st_mtime; - il_log(LOG_DEBUG, " event store offset set to %ld\n", last); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " event store offset set to %ld", last); if(msg) server_msg_free(msg); fclose(ef); - il_log(LOG_DEBUG, " finished reading events with %d\n", ret); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " finished reading events with %d", ret); if(pthread_rwlock_unlock(&es->offset_lock)) abort(); @@ -1022,20 +1045,23 @@ event_store_clean(struct event_store *es) /* prevent sender threads from updating */ event_store_lock(es); - il_log(LOG_DEBUG, " trying to cleanup event store %s\n", es->job_id_s); - il_log(LOG_DEBUG, " bytes sent to logging server: %d\n", es->last_committed_ls); - il_log(LOG_DEBUG, " bytes sent to bookkeeping server: %d\n", es->last_committed_bs); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " trying to cleanup event store %s", es->job_id_s); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " bytes sent to logging server: %d", es->last_committed_ls); + glite_common_log(LOG_CATEGORY_LB_IL, 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); - il_log(LOG_DEBUG, " not all events sent, cleanup aborted\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " not all events sent, cleanup aborted"); return(0); } if(fd = pthread_rwlock_wrlock(&es->offset_lock)) { - fprintf(stderr, "Fatal locking error: %s\n", strerror(fd)); abort(); } @@ -1049,7 +1075,8 @@ event_store_clean(struct event_store *es) event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) abort(); - il_log(LOG_ERR, " event_store_clean: error opening event file: %s\n", strerror(errno)); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " event_store_clean: error opening event file: %s", strerror(errno)); return(1); } @@ -1061,7 +1088,8 @@ event_store_clean(struct event_store *es) efl.l_start = 0; efl.l_len = 0; if(fcntl(fd, F_SETLK, &efl) < 0) { - il_log(LOG_DEBUG, " could not lock event file, cleanup aborted\n"); + glite_comon_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + " could not lock event file, cleanup aborted"); fclose(ef); event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) @@ -1086,17 +1114,20 @@ event_store_clean(struct event_store *es) } last = ftell(ef); - il_log(LOG_DEBUG, " total bytes in file: %d\n", last); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " total bytes in file: %d", last); if(es->last_committed_ls < last) { fclose(ef); event_store_unlock(es); if(pthread_rwlock_unlock(&es->offset_lock)) abort(); - il_log(LOG_DEBUG, " events still waiting in queue, cleanup aborted\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " events still waiting in queue, cleanup aborted"); return(0); } else if( es->last_committed_ls > last) { - il_log(LOG_WARNING, " warning: event file seems to shrink!\n"); + glite_common_log(LOG_CATEGORY_LB_IL, 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 */ fclose(ef); @@ -1107,7 +1138,8 @@ event_store_clean(struct event_store *es) } /* now we are sure that all events were sent and the event queues are empty */ - il_log(LOG_INFO, " removing event file %s\n", es->event_file_name); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + " removing event file %s", es->event_file_name); /* remove the event file */ unlink(es->event_file_name); @@ -1255,7 +1287,8 @@ event_store_release(struct event_store *es) if(pthread_rwlock_unlock(&es->use_lock)) abort(); - il_log(LOG_DEBUG, " released lock on %s (%s)\n", es->job_id_s, es->event_file_name); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " released lock on %s (%s)", es->job_id_s, es->event_file_name); return(0); } @@ -1275,10 +1308,11 @@ event_store_from_file(char *filename) #endif - il_log(LOG_INFO, " attaching to event file: %s\n", filename); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + " attaching to event file: %s", filename); if(strstr(filename, "quarantine") != NULL) { - il_log(LOG_INFO, " file name belongs to quarantine, not touching that.\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " file name belongs to quarantine, not touching that."); return(0); } @@ -1322,9 +1356,11 @@ event_store_from_file(char *filename) #else job_id_s = edg_wll_GetJobId(event_s); #endif - il_log(LOG_DEBUG, " event id: '%s'\n", job_id_s); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " event id: '%s'", job_id_s); if(job_id_s == NULL) { - il_log(LOG_NOTICE, " skipping file, could not parse event\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " skipping file, could not parse event"); ret = 0; goto out; } @@ -1472,9 +1508,11 @@ event_store_init(char *prefix) } else { /* could not stat file, remove ctl */ strcat(ef, s); - il_log(LOG_DEBUG, " removing stale file %s\n", ef); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " removing stale file %s", ef); if(unlink(ef)) - il_log(LOG_ERR, " could not remove file %s: %s\n", ef, strerror(errno)); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " could not remove file %s: %s\n", ef, strerror(errno)); } free(ef); @@ -1505,7 +1543,9 @@ 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) { - il_log(LOG_ERR, " error recovering event store %s:\n %s\n", sl->es->event_file_name, error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " error recovering event store %s: %s", + sl->es->event_file_name, error_get_msg()); clear_error(); } sl = sl->next; @@ -1528,8 +1568,9 @@ event_store_remove(struct event_store *es) switch(event_store_clean(es)) { case 0: - il_log(LOG_DEBUG, " event store not removed, still used\n"); - return(0); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " event store not removed, still used"); + return(0); case 1: if(pthread_rwlock_wrlock(&store_list_lock) < 0) { @@ -1588,7 +1629,8 @@ event_store_cleanup() /* one event store at time */ ret = pthread_rwlock_trywrlock(&sl->es->use_lock); if(ret == EBUSY) { - il_log(LOG_DEBUG, " event_store %s is in use by another thread\n", + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + " event_store %s is in use by another thread", sl->es->job_id_s); sl = slnext; continue; @@ -1610,8 +1652,9 @@ event_store_cleanup() break; case -1: - il_log(LOG_ERR, " error removing event store %s (file %s):\n %s\n", - sl->es->job_id_s, sl->es->event_file_name, error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, 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); */ clear_error(); /* go on to the next */ diff --git a/org.glite.lb.logger/src/il_error.c b/org.glite.lb.logger/src/il_error.c index 630bd75..1608f5b 100644 --- a/org.glite.lb.logger/src/il_error.c +++ b/org.glite.lb.logger/src/il_error.c @@ -14,12 +14,9 @@ extern void _start (void), etext (void); #endif #include "glite/security/glite_gss.h" - #include "il_error.h" -extern int log_level; - static pthread_key_t err_key; static int IL_ERR_MSG_LEN = 1024; @@ -55,7 +52,7 @@ error_get_err () int -init_errors(int level) +init_errors() { static pthread_once_t error_once = PTHREAD_ONCE_INIT; struct error_inf *err; @@ -79,9 +76,6 @@ init_errors(int level) if(err->msg == NULL) return(-1); - if(level) - log_level = level; - #ifdef LB_PROF monstartup((u_long)&_start, (u_long)&etext); #endif diff --git a/org.glite.lb.logger/src/il_error.h b/org.glite.lb.logger/src/il_error.h index 09c593e..5fb5b4f 100644 --- a/org.glite.lb.logger/src/il_error.h +++ b/org.glite.lb.logger/src/il_error.h @@ -21,13 +21,11 @@ struct error_inf { char *msg; }; -int init_errors(int); +int init_errors(); int set_error(int, long, char *); int clear_error(); int error_get_maj(); long error_get_min(); char *error_get_msg(); -int il_log(int, char *, ...); - #endif diff --git a/org.glite.lb.logger/src/il_master.c b/org.glite.lb.logger/src/il_master.c index 476db17..77838dc 100644 --- a/org.glite.lb.logger/src/il_master.c +++ b/org.glite.lb.logger/src/il_master.c @@ -83,7 +83,8 @@ parse_cmd(char *event, char **job_id_s, long *receipt, int *timeout) #if defined(INTERLOGD_FLUSH) if(strcmp(++r, "\"flush\"")) { #endif - il_log(LOG_WARNING, " command %s not implemented\n", r); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, "command %s not implemented", + r); ret = -1; continue; #if defined(INTERLOGD_FLUSH) @@ -131,7 +132,7 @@ handle_cmd(il_octet_string_t *event, long offset) return(0); #if defined(INTERLOGD_FLUSH) - il_log(LOG_DEBUG, " received FLUSH command\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, "received FLUSH command"); /* catchup with all neccessary event files */ if(job_id_s) { @@ -145,15 +146,16 @@ 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) { - il_log(LOG_ERR, " error trying to catch up with event file: %s\n", - error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " error trying to catch up with event file: %s", + error_get_msg()); clear_error(); } } else /* this call does not fail :-) */ event_store_recover_all(); - il_log(LOG_DEBUG, " alerting threads to report status\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " alerting threads to report status"); /* prevent threads from reporting too early */ if(pthread_mutex_lock(&flush_lock) < 0) { @@ -209,7 +211,9 @@ 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) { - il_log(LOG_ERR, " error waiting for thread reply: %s\n", strerror(errno)); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " error waiting for thread reply: %s", + strerror(errno)); result = (ret == ETIMEDOUT) ? 0 : -1; break; } @@ -237,7 +241,9 @@ handle_cmd(il_octet_string_t *event, long offset) if(eq->flushing == 2) { eq->flushing = 0; num_replies++; - il_log(LOG_DEBUG, " thread reply: %d\n", eq->flush_result); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " thread reply: %d", + eq->flush_result); result = ((result == 1) || (eq->flush_result < 0)) ? eq->flush_result : result; } @@ -276,7 +282,9 @@ 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) - il_log(LOG_ERR, "handle_cmd: error sending status: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + "handle_cmd: error sending status: %s", + error_get_msg()); return(1); @@ -305,7 +313,9 @@ handle_msg(il_octet_string_t *event, long offset) /* convert event to message for server */ if((msg = server_msg_create(event, offset)) == NULL) { - il_log(LOG_ERR, " handle_msg: error parsing event '%s':\n %s\n", event, error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + " handle_msg: error parsing event '%s': %s", + event, error_get_msg()); return(0); } @@ -325,7 +335,9 @@ 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) { - il_log(LOG_ERR, " handle_msg: error syncing event store:\n %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, 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? */ /* Probably no, because the attempt to recover means we have missed some events, and delivery of this one will not move offset ahead. So try our best and deliver it @@ -349,7 +361,9 @@ handle_msg(il_octet_string_t *event, long offset) eq_s = queue_list_get(msg->job_id_s); #endif if(eq_s == NULL) { - il_log(LOG_ERR, " handle_msg: apropriate queue not found: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + " handle_msg: apropriate queue not found: %s", + error_get_msg()); clear_error(); } else { if(enqueue_msg(eq_s, msg) < 0) @@ -399,7 +413,8 @@ loop() if((ret = input_queue_get(&msg, &offset, INPUT_TIMEOUT)) < 0) { if(error_get_maj() == IL_PROTO) { - il_log(LOG_DEBUG, " premature EOF while receiving event\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " premature EOF while receiving event"); /* problems with socket input, try to catch up from files */ #ifndef PERF_EMPTY event_store_recover_all(); @@ -431,7 +446,9 @@ loop() return (ret); break; default: - il_log(LOG_ERR, "Error: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + "Error: %s", + error_get_msg()); break; } } /* while */ diff --git a/org.glite.lb.logger/src/input_queue_socket.c b/org.glite.lb.logger/src/input_queue_socket.c index 05a0034..7ced2fd 100644 --- a/org.glite.lb.logger/src/input_queue_socket.c +++ b/org.glite.lb.logger/src/input_queue_socket.c @@ -36,7 +36,9 @@ input_queue_attach() if(connect(sock, (struct sockaddr *)&saddr, sizeof(saddr.sun_path)) < 0) { if(errno == ECONNREFUSED) { /* socket present, but no one at the other end; remove it */ - il_log(LOG_WARNING, " removing stale input socket %s\n", socket_path); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, + " removing stale input socket %s", + socket_path); unlink(socket_path); } /* ignore other errors for now */ @@ -292,7 +294,8 @@ input_queue_get(il_octet_string_t **buffer, long *offset, int timeout) case -1: /* error */ switch(errno) { case EINTR: - il_log(LOG_DEBUG, " interrupted while waiting for event!\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + " interrupted while waiting for event!"); return(0); default: diff --git a/org.glite.lb.logger/src/interlogd.c b/org.glite.lb.logger/src/interlogd.c index 51a5a74..afec957 100644 --- a/org.glite.lb.logger/src/interlogd.c +++ b/org.glite.lb.logger/src/interlogd.c @@ -283,8 +283,49 @@ decode_switches (int argc, char **argv) void handle_signal(int num) { - il_log(LOG_DEBUG, "Received signal %d\n", num); - killflg++; + + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Received signal %d\n", num); + + switch(num) { + case SIGHUP: + log4c_reread(); + break; + + case SIGUSR1: + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, + "Logging priority is now %s for %s, %s for %s and %s for %s\n", + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_SECURITY))), + LOG_CATEGORY_SECURITY, + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_ACCESS))), + LOG_CATEGORY_ACCESS, + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_CONTROL))), + LOG_CATEGORY_CONTROL); + break; + + case SIGUSR2: + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, + "Logging priority is now %s for %s, %s for %s, %s for %s and %s for %s\n", + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_LB))), + LOG_CATEGORY_LB, + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_LB_LOGD))), + LOG_CATEGORY_LB_LOGD, + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_LB_IL))), + LOG_CATEGORY_LB_IL, + log4c_priority_to_string(log4c_category_get_priority(log4c_category_get(LOG_CATEGORY_LB_SERVER))), + LOG_CATEGORY_LB_SERVER); + break; + + case SIGPIPE: + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Broken pipe, lost communication channel.\n"); + break; + + case SIGINT: + case SIGTERM: + case SIGQUIT: + killflg++; + break; + + } } @@ -305,10 +346,15 @@ main (int argc, char **argv) i = decode_switches (argc, argv); + if(glite_common_log_init()) { + fprintf(stderr, "glite_common_log_init() failed, exiting.\n"); + exit(EXIT_FAILURE); + } + /* check for reasonable queue lengths */ if(queue_size_low == 0 && queue_size_high > 0 || queue_size_low > queue_size_high) { - fprintf(stderr, "max queue length -Q must be greater than low queue length -q, both or none must be specified!\n"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "max queue length -Q must be greater than low queue length -q, both or none must be specified!"); exit(EXIT_FAILURE); } @@ -318,23 +364,26 @@ main (int argc, char **argv) bs_only = 1; } - if(init_errors(verbose ? LOG_DEBUG : LOG_WARNING)) { - fprintf(stderr, "Failed to initialize error message subsystem. Exiting.\n"); - exit(EXIT_FAILURE); + /* initialize error reporting */ + if(init_errors()) { + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to initialize error message subsystem. Exiting."); + exit(EXIT_FAILURE); } if (signal(SIGPIPE, SIG_IGN) == SIG_ERR || signal(SIGABRT, handle_signal) == SIG_ERR || signal(SIGTERM, handle_signal) == SIG_ERR || signal(SIGINT, handle_signal) == SIG_ERR) { - perror("signal"); - exit(EXIT_FAILURE); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to setup signal handlers: %s, exiting.", + strerror(errno)); + exit(EXIT_FAILURE); } if(!debug && (daemon(0,0) < 0)) { - perror("daemon"); - exit(EXIT_FAILURE); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to daemonize itself: %s, exiting.", + strerror(errno)); + exit(EXIT_FAILURE); } #ifdef LB_PERF @@ -346,21 +395,23 @@ main (int argc, char **argv) njobs); #endif - il_log(LOG_INFO, "Initializing input queue...\n"); if(input_queue_attach() < 0) { - il_log(LOG_CRIT, "Failed to initialize input queue: %s\n", error_get_msg()); - exit(EXIT_FAILURE); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to initialize input queue: %s", + error_get_msg()); + exit(EXIT_FAILURE); } + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Initialized input queue."); /* initialize output queues */ - il_log(LOG_INFO, "Initializing event queues...\n"); if(queue_list_init(log_server) < 0) { - il_log(LOG_CRIT, "Failed to initialize output event queues: %s\n", error_get_msg()); - exit(EXIT_FAILURE); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to initialize output event queues: %s", + error_get_msg()); + exit(EXIT_FAILURE); } + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Initialized event queues."); if(lazy_close) - il_log(LOG_DEBUG, " using lazy mode when closing connections, timeout %d\n", - default_close_timeout); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, " using lazy mode when closing connections, timeout %d", + default_close_timeout); /* get credentials */ if (CAcert_dir) @@ -368,7 +419,7 @@ main (int argc, char **argv) edg_wll_gss_watch_creds(cert_file,&cert_mtime); cred_handle = malloc(sizeof(*cred_handle)); if(cred_handle == NULL) { - il_log(LOG_CRIT, "Failed to allocate structure for credentials.\n"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to allocate structure for credentials."); exit(EXIT_FAILURE); } cred_handle->creds = NULL; @@ -376,25 +427,24 @@ main (int argc, char **argv) ret = edg_wll_gss_acquire_cred_gsi(cert_file, key_file, &cred_handle->creds, &gss_stat); if (ret) { char *gss_err = NULL; - char *str; if (ret == EDG_WLL_GSS_ERROR_GSS) edg_wll_gss_get_error(&gss_stat, "edg_wll_gss_acquire_cred_gsi()", &gss_err); - asprintf(&str, "Failed to load GSI credential: %s\n", - (gss_err) ? gss_err : "edg_wll_gss_acquire_cred_gsi() failed"); - il_log(LOG_CRIT, str); - free(str); + glite_common_log(LOG_CATEGORY_SECURITY, LOG_PRIORITY_FATAL, "Failed to load GSI credential: %s, exiting.", + (gss_err) ? gss_err : "edg_wll_gss_acquire_cred_gsi() failed"); if (gss_err) free(gss_err); exit(EXIT_FAILURE); } + glite_common_log(LOG_CATEGORY_SECURITY, LOG_PRIORITY_INFO, "Using certificate %s", cred_handle->creds->name); #ifndef PERF_EMPTY /* find all unsent events waiting in files */ #ifdef LB_PERF if(norecover) { if(event_store_init(file_prefix) < 0) { - il_log(LOG_CRIT, "Failed to init event stores: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to initialize event stores: %s", + error_get_msg()); exit(EXIT_FAILURE); } } else @@ -402,26 +452,26 @@ main (int argc, char **argv) { pthread_t rid; - il_log(LOG_INFO, "Starting recovery thread...\n"); if(pthread_create(&rid, NULL, recover_thread, NULL) < 0) { - il_log(LOG_CRIT, "Failed to start recovery thread: %s\n", strerror(errno)); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Failed to start recovery thread: %s", strerror(errno)); exit(EXIT_FAILURE); } pthread_detach(rid); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Started recovery thread."); } #endif - il_log(LOG_INFO, "Entering main loop...\n"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Entering main loop."); /* do the work */ if(loop() < 0) { - il_log(LOG_CRIT, "Fatal error: %s\n", error_get_msg()); - if (killflg) { - input_queue_detach(); - exit(EXIT_FAILURE); - } + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, "Fatal error: %s", error_get_msg()); + if (killflg) { + input_queue_detach(); + exit(EXIT_FAILURE); + } } - il_log(LOG_INFO, "Done!\n"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Done!"); input_queue_detach(); exit (0); diff --git a/org.glite.lb.logger/src/interlogd.h b/org.glite.lb.logger/src/interlogd.h index 4ef2f2b..da3f493 100644 --- a/org.glite.lb.logger/src/interlogd.h +++ b/org.glite.lb.logger/src/interlogd.h @@ -6,6 +6,7 @@ #include "il_error.h" #include "glite/security/glite_gss.h" #include "glite/lb/il_msg.h" +#include "glite/lbu/log.h" #include #include diff --git a/org.glite.lb.logger/src/queue_thread.c b/org.glite.lb.logger/src/queue_thread.c index da2cb57..ea596a8 100644 --- a/org.glite.lb.logger/src/queue_thread.c +++ b/org.glite.lb.logger/src/queue_thread.c @@ -13,7 +13,7 @@ queue_thread_cleanup(void *q) { struct event_queue *eq = (struct event_queue *)q; - il_log(LOG_WARNING, "thread %d exits\n", eq->thread_id); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, "thread %d exits", eq->thread_id); /* unlock all held locks */ /* FIXME: check that the thread always exits when holding these locks; @@ -48,11 +48,14 @@ queue_thread(void *q) int exit_timeout = EXIT_TIMEOUT; if(init_errors(0) < 0) { - il_log(LOG_ERR, "Error initializing thread specific data, exiting!"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, + "Error initializing thread specific data, exiting!"); pthread_exit(NULL); } - il_log(LOG_DEBUG, " started new thread for delivery to %s:%d\n", eq->dest_name, eq->dest_port); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, + " started new thread for delivery to %s:%d", + eq->dest_name, eq->dest_port); pthread_cleanup_push(queue_thread_cleanup, q); @@ -75,14 +78,17 @@ queue_thread(void *q) ret = event_queue_wait(eq, close_timeout); if(ret == 1) {/* timeout? */ event_queue_close(eq); - il_log(LOG_DEBUG, " connection to %s:%d closed\n", - eq->dest_name, eq->dest_port); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " connection to %s:%d closed", + eq->dest_name, eq->dest_port); } close_timeout = 0; } else { ret = event_queue_wait(eq, exit_timeout); if(ret == 1) { - il_log(LOG_INFO, " thread idle for more than %d seconds, exiting\n", exit_timeout); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, + " thread idle for more than %d seconds, exiting", + exit_timeout); event_queue_close(eq); event_queue_cond_unlock(eq); pthread_exit((void*)0); @@ -90,7 +96,9 @@ queue_thread(void *q) } if(ret < 0) { /* error waiting */ - il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, + "queue_thread: %s", + error_get_msg()); event_queue_cond_unlock(eq); pthread_exit((void*)-1); } @@ -103,22 +111,29 @@ queue_thread(void *q) event_queue_cond_unlock(eq); /* discard expired events */ - il_log(LOG_DEBUG, " discarding expired events\n"); + glite_common_log(LOG_CATEGORY_LB_IL, 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 */ - il_log(LOG_DEBUG, " attempting delivery to %s:%d\n", eq->dest_name, eq->dest_port); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " attempting delivery to %s:%d", + eq->dest_name, eq->dest_port); /* connect to server */ if((ret=event_queue_connect(eq)) == 0) { /* not connected */ if(error_get_maj() != IL_OK) - il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + "queue_thread: %s", error_get_msg()); #if defined(IL_NOTIFICATIONS) - il_log(LOG_INFO, " could not connect to client %s, waiting for retry\n", eq->dest_name); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + " could not connect to client %s, waiting for retry", + eq->dest_name); #else - il_log(LOG_INFO, " could not connect to bookkeeping server %s, waiting for retry\n", eq->dest_name); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, + " could not connect to bookkeeping server %s, waiting for retry", + eq->dest_name); #endif retrycnt++; } else { @@ -129,18 +144,25 @@ queue_thread(void *q) case 0: /* there was an error and we still have events to send */ if(error_get_maj() != IL_OK) - il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg()); - il_log(LOG_DEBUG, " events still waiting\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, + "queue_thread: %s", + error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " events still waiting"); break; case 1: /* hey, we are done for now */ - il_log(LOG_DEBUG, " all events for %s sent\n", eq->dest_name); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " all events for %s sent", + eq->dest_name); break; default: /* internal error */ - il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + "queue_thread: %s", + error_get_msg()); exit = 1; break; @@ -151,8 +173,9 @@ queue_thread(void *q) close_timeout = default_close_timeout; else { event_queue_close(eq); - il_log(LOG_DEBUG, " connection to %s:%d closed\n", - eq->dest_name, eq->dest_port); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " connection to %s:%d closed", + eq->dest_name, eq->dest_port); } } } @@ -164,7 +187,8 @@ queue_thread(void *q) /* Check if we are flushing and if we are, report status to master */ if(eq->flushing == 1) { - il_log(LOG_DEBUG, " flushing mode detected, reporting status\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " flushing mode detected, reporting status"); /* 0 - events waiting, 1 - events sent, < 0 - some error */ eq->flush_result = ret; eq->flushing = 2; @@ -182,7 +206,8 @@ queue_thread(void *q) which may cure server kicking us out after given number of connections */ #ifndef LB_PERF if((ret == 0) && (retrycnt > 0)) { - il_log(LOG_WARNING, " sleeping\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " sleeping"); event_queue_sleep(eq); } #endif diff --git a/org.glite.lb.logger/src/recover.c b/org.glite.lb.logger/src/recover.c index 18fc3b4..29b2e2e 100644 --- a/org.glite.lb.logger/src/recover.c +++ b/org.glite.lb.logger/src/recover.c @@ -14,25 +14,30 @@ void * recover_thread(void *q) { if(init_errors(0) < 0) { - il_log(LOG_ERR, "Error initializing thread specific data, exiting!"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, + "Error initializing thread specific data, exiting!"); pthread_exit(NULL); } while(1) { - il_log(LOG_INFO, "Looking up event files...\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + "Looking up event files."); if(event_store_init(file_prefix) < 0) { - il_log(LOG_ERR, "recover_thread: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, + "recover_thread: %s", error_get_msg()); exit(1); } if(event_store_recover_all() < 0) { - il_log(LOG_ERR, "recover_thread: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, + "recover_thread: %s", error_get_msg()); exit(1); } if(event_store_cleanup() < 0) { - il_log(LOG_ERR, "recover_thread: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, + "recover_thread: %s", error_get_msg()); exit(1); } - il_log(LOG_INFO, "Reloading certificate...\n"); + glite_common_log(LOG_CATEGORY_SECURITY, LOG_PRIORITY_DEBUG, "Checking for new certificate."); if (edg_wll_gss_watch_creds(cert_file, &cert_mtime) > 0) { edg_wll_GssCred new_creds = NULL; int ret; @@ -46,18 +51,22 @@ recover_thread(void *q) if(cred_handle && cred_handle->counter == 0) { edg_wll_gss_release_cred(&cred_handle->creds, NULL); free(cred_handle); - il_log(LOG_DEBUG, " freed old credentials\n"); + glite_common_log(LOG_CATEGORY_SECURITY, LOG_PRIORITY_DEBUG, + " freed old credentials"); } cred_handle = malloc(sizeof(*cred_handle)); if(cred_handle == NULL) { - il_log(LOG_CRIT, "Failed to allocate structure for credentials.\n"); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL, + "Failed to allocate structure for credentials."); exit(EXIT_FAILURE); } cred_handle->creds = new_creds; cred_handle->counter = 0; if(pthread_mutex_unlock(&cred_handle_lock) < 0) abort(); - il_log(LOG_INFO, "New certificate found and deployed.\n"); + glite_common_log(LOG_CATEGORY_SECURITY, LOG_PRIORITY_INFO, + "New certificate %s found and deployed.", + new_creds->name); } } sleep(INPUT_TIMEOUT); diff --git a/org.glite.lb.logger/src/send_event.c b/org.glite.lb.logger/src/send_event.c index cb1a40b..30a3d75 100644 --- a/org.glite.lb.logger/src/send_event.c +++ b/org.glite.lb.logger/src/send_event.c @@ -60,7 +60,9 @@ send_confirmation(long lllid, int code) } ret = 1; - il_log(LOG_DEBUG, " sent code %d back to client\n", code); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " sent code %d back to client", + code); out: close(sock); @@ -188,7 +190,9 @@ event_queue_connect(struct event_queue *eq) if(pthread_mutex_unlock(&cred_handle_lock) < 0) abort(); - il_log(LOG_DEBUG, " trying to connect to %s:%d\n", eq->dest_name, eq->dest_port); + glite_common_log(LOG_CATEGORY_LB_IL, 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); if(pthread_mutex_lock(&cred_handle_lock) < 0) abort(); @@ -197,7 +201,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); - il_log(LOG_DEBUG, " freed credentials, not used anymore\n"); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, " freed credentials, not used anymore"); } if(pthread_mutex_unlock(&cred_handle_lock) < 0) abort(); @@ -278,7 +282,9 @@ event_queue_send(struct event_queue *eq) if(event_queue_get(eq, &msg) < 0) return(-1); - il_log(LOG_DEBUG, " trying to deliver event at offset %d for job %s\n", msg->offset, msg->job_id_s); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " trying to deliver event at offset %d for job %s", + msg->offset, msg->job_id_s); #ifdef LB_PERF if(!nosend) { @@ -303,7 +309,8 @@ event_queue_send(struct event_queue *eq) eq->timeout = 1; } else { eq->timeout = TIMEOUT; - il_log(LOG_ERR, " error reading server %s reply:\n %s\n", eq->dest_name, error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_WARN, " error reading server %s reply: %s", + eq->dest_name, error_get_msg()); } return(0); } @@ -317,7 +324,9 @@ event_queue_send(struct event_queue *eq) } #endif - il_log(LOG_DEBUG, " event sent, server %s replied with %d, %s\n", eq->dest_name, code, rep); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_DEBUG, + " event sent, server %s replied with %d, %s", + eq->dest_name, code, rep); free(rep); /* the reply is back here */ @@ -350,7 +359,9 @@ event_queue_send(struct event_queue *eq) if((ret == 0) && (error_get_maj() != IL_OK)) - il_log(LOG_ERR, "send_event: %s\n", error_get_msg()); + glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_ERROR, + "send_event: %s", + error_get_msg()); event_queue_remove(eq); eq->first_event_sent = 1;