From: Marc Cromme Date: Thu, 12 Apr 2007 12:05:22 +0000 (+0000) Subject: added logging of searchRequest RPN query for debugging X-Git-Tag: PAZPAR2.1.0.0~314 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=656003cf8dbfe862254776c2bc938ae0c83fb4c6;p=pazpar2-moved-to-github.git added logging of searchRequest RPN query for debugging might get removed later again when logs grow too much --- diff --git a/src/pazpar2.c b/src/pazpar2.c index 2e13c5d..117c61f 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -1,4 +1,4 @@ -/* $Id: pazpar2.c,v 1.75 2007-04-12 09:59:47 marc Exp $ +/* $Id: pazpar2.c,v 1.76 2007-04-12 12:05:22 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -39,6 +39,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include +#include #if HAVE_CONFIG_H #include "cconfig.h" @@ -235,7 +236,7 @@ static void send_search(IOCHAN i) char *recsyn; char *piggyback; - yaz_log(YLOG_DEBUG, "Sending search"); + yaz_log(YLOG_DEBUG, "Sending search to %s", cl->database->database->url); cn = ccl_find_str(sdb->database->ccl_map, se->query, &cerror, &cpos); if (!cn) @@ -276,14 +277,27 @@ static void send_search(IOCHAN i) a->u.searchRequest->databaseNames = databaselist; a->u.searchRequest->num_databaseNames = ndb; - if (send_apdu(cl, a) >= 0) - { - iochan_setflags(i, EVENT_INPUT); - cl->state = Client_Searching; - cl->requestid = se->requestid; - } - else - cl->state = Client_Error; + + { //scope for sending and logging queries + WRBUF wbquery = wrbuf_alloc(); + yaz_query_to_wrbuf(wbquery, zquery); + + if (send_apdu(cl, a) >= 0) + { + iochan_setflags(i, EVENT_INPUT); + cl->state = Client_Searching; + cl->requestid = se->requestid; + yaz_log(YLOG_LOG, "SearchRequest %s %s", + cl->database->database->url, wrbuf_cstr(wbquery)); + } + else { + cl->state = Client_Error; + yaz_log(YLOG_WARN, "Failed SearchRequest %s %s", + cl->database->database->url, wrbuf_cstr(wbquery)); + } + + wrbuf_destroy(wbquery); + } odr_reset(global_parameters.odr_out); }