From e8dcd4b460f01eca5f05ed51179d3539da97437e Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Tue, 12 May 2015 14:37:15 +0200 Subject: [PATCH] MPSPARQL-19: Clean up logging Log the queries once, do not log the HTTP req/resp, but do log responses in case of errors --- bibframe/triplestore.xml | 7 ++++--- src/filter_sparql.cpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bibframe/triplestore.xml b/bibframe/triplestore.xml index 415e66a..2686042 100644 --- a/bibframe/triplestore.xml +++ b/bibframe/triplestore.xml @@ -203,9 +203,9 @@ - %v_inst bf:instanceOf ?thing FILTER ( %v_inst = %u) + %v_inst bf:instanceOf ?thing FILTER ( %v_inst = %u) - + @@ -588,9 +588,10 @@ http + - true diff --git a/src/filter_sparql.cpp b/src/filter_sparql.cpp index 638d2ba..d9b51eb 100644 --- a/src/filter_sparql.cpp +++ b/src/filter_sparql.cpp @@ -549,7 +549,6 @@ Z_Records *yf::SPARQL::Session::fetch( 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); } @@ -616,7 +615,7 @@ int yf::SPARQL::Session::invoke_sparql(mp::Package &package, gdu->u.HTTP_Request->content_buf = path; gdu->u.HTTP_Request->content_len = strlen(path); - yaz_log(YLOG_LOG, "sparql: HTTP request\n%s", sparql_query); + yaz_log(YLOG_DEBUG, "sparql: HTTP request\n%s", sparql_query); http_package.request() = gdu; http_package.move(); @@ -630,8 +629,14 @@ int yf::SPARQL::Session::invoke_sparql(mp::Package &package, } else if (gdu_resp->u.HTTP_Response->code != 200) { + Z_HTTP_Response *resp = gdu_resp->u.HTTP_Response; wrbuf_printf(w, "sparql: HTTP error %d from backend", - gdu_resp->u.HTTP_Response->code); + resp->code); + package.log("sparql", YLOG_LOG, + "HTTP error %d from backend ", + resp->code ); + package.log("sparql", YLOG_LOG, + "%.*s" , resp->content_len, resp->content_buf ); return YAZ_BIB1_TEMPORARY_SYSTEM_ERROR; } Z_HTTP_Response *resp = gdu_resp->u.HTTP_Response; @@ -681,7 +686,7 @@ Z_APDU *yf::SPARQL::Session::search(mp::Package &package, result.doc = doc; result.conf = conf; fset->results.push_back(result); - yaz_log(YLOG_LOG, "saving sparql result xmldoc=%p", doc); + yaz_log(YLOG_DEBUG, "saving sparql result xmldoc=%p", doc); get_result(result.doc, &fset->hits, -1, 0); m_frontend_sets[req->resultSetName] = fset; -- 1.7.10.4