From 9eae799a402bdbb99c889b729fe87491f5ff85ff Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 30 Jan 2004 01:30:30 +0000 Subject: [PATCH] Log libxml2/libxslt errors in yaz_log --- ChangeLog | 2 ++ TODO | 2 -- src/yaz-proxy-main.cpp | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a9146f..b2ec376 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ +Log libxml2/libxslt errors in yaz log. + Update proxy to work with SRW diagnostic code as a URI/string. Proxy now throws 'unsupported transfer syntax' / 'unsupported ESN' properly. diff --git a/TODO b/TODO index 54ebda4..d1b25c1 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,4 @@ -Try to catch libxml2/libxslt errors and log.. - Proxy doesn't do well, if preferredRecordSyntax is not set. Per database config. diff --git a/src/yaz-proxy-main.cpp b/src/yaz-proxy-main.cpp index 4a7a9b7..614dfa0 100644 --- a/src/yaz-proxy-main.cpp +++ b/src/yaz-proxy-main.cpp @@ -2,13 +2,14 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy-main.cpp,v 1.30 2004-01-12 22:35:26 adam Exp $ + * $Id: yaz-proxy-main.cpp,v 1.31 2004-01-30 01:30:30 adam Exp $ */ #include #include #include #include +#include #include #include @@ -131,11 +132,29 @@ static void sighup_handler(int num) static_yaz_proxy->reconfig(); } +#if HAVE_XSLT +static void proxy_xml_error_handler(void *ctx, const char *fmt, ...) +{ + char buf[1024]; + + va_list ap; + va_start(ap, fmt); + + vsnprintf(buf, sizeof(buf), fmt, ap); + + yaz_log(LOG_WARN, "%s", buf); + + va_end (ap); +} +#endif static void child_run(Yaz_SocketManager *m, int run) { signal(SIGHUP, sighup_handler); +#if HAVE_XSLT + xmlSetGenericErrorFunc(0, proxy_xml_error_handler); +#endif yaz_log(LOG_LOG, "0 proxy run=%d pid=%ld", run, (long) getpid()); if (pid_fname) { -- 1.7.10.4