From: Heikki Levanto Date: Tue, 12 May 2015 12:02:54 +0000 (+0200) Subject: MPSPARQL-19: use package.log to return the queries for debugging X-Git-Tag: v0.6~17 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=1bd695eb9f4b166b5d32cd5ddac1b1cdf41c14f1;p=mp-sparql-moved-to-github.git MPSPARQL-19: use package.log to return the queries for debugging --- diff --git a/src/filter_sparql.cpp b/src/filter_sparql.cpp index cef45ef..638d2ba 100644 --- a/src/filter_sparql.cpp +++ b/src/filter_sparql.cpp @@ -448,6 +448,7 @@ Z_Records *yf::SPARQL::Session::fetch( std::list::iterator it = fset->results.begin(); const char *schema = 0; bool uri_lookup = false; + bool fetch_logged = false; if (esn && esn->which == Z_ElementSetNames_generic) schema = esn->u.generic; @@ -536,7 +537,19 @@ Z_Records *yf::SPARQL::Session::fetch( uri.c_str(), schema); if (!error) { - yaz_log(YLOG_LOG, "query=%s", query.c_str()); + if (!fetch_logged) + { // Log the fetch query only once + package.log("sparql", YLOG_LOG, + "fetch query: for %s \n%s", + uri.c_str(), query.c_str() ); + fetch_logged = true; + } + else + { + package.log("sparql", YLOG_LOG, + "fetch uri:%s", uri.c_str() ); + } + //yaz_log(YLOG_LOG, "query=%s", query.c_str()); error = invoke_sparql(package, query.c_str(), it->conf, w); } @@ -636,6 +649,9 @@ Z_APDU *yf::SPARQL::Session::search(mp::Package &package, Z_APDU *apdu_res = 0; mp::wrbuf w; + package.log("sparql", YLOG_LOG, + "search query:\n%s", sparql_query ); + int error = invoke_sparql(package, sparql_query, conf, w); if (error) {