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);
}
/* 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) {
}
/* 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) {
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);
/* 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);
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);
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) {
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? */
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;
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);
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 */
/* 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);
}
/* 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? */
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);
}
}
#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)) {
/* 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) {
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))
/* 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);
}
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);
}
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);
}
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) {
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 */
}
/* 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 */
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);
}
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);
}
#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;
} 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));
}
/* 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();
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);
/* 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;
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); */
#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;
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) {
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();
/* 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) {
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;
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)) ?
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);
/* 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);
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? */
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();
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
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;
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);
}
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
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;
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);
}
/* 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;
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);
}