Fixed bug #322: yaz server does not log listener address if given
[yaz-moved-to-github.git] / src / statserv.c
index f6542c6..b92aac4 100644 (file)
@@ -5,7 +5,7 @@
  * NT threaded server code by
  *   Chas Woodfield, Fretwell Downing Informatics.
  *
- * $Id: statserv.c,v 1.27 2005-03-08 11:48:09 adam Exp $
+ * $Id: statserv.c,v 1.30 2005-05-08 07:13:57 adam Exp $
  */
 
 /**
@@ -38,6 +38,7 @@
 #if HAVE_XML2
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <libxml/xinclude.h>
 #endif
 
 #if YAZ_POSIX_THREADS
@@ -440,8 +441,18 @@ static void xml_config_open()
        xml_config_doc = xmlParseFile(control_block.xml_config);
        if (!xml_config_doc)
        {
-           yaz_log(YLOG_WARN, "Could not parse %s", control_block.xml_config);
-           return ;
+           yaz_log(YLOG_FATAL, "Could not parse %s", control_block.xml_config);
+           exit(1);
+       }
+       else
+       {
+           int noSubstitutions = xmlXIncludeProcess(xml_config_doc);
+           if (noSubstitutions == -1)
+           {
+               yaz_log(YLOG_WARN, "XInclude processing failed for config %s",
+                       control_block.xml_config);
+               exit(1);
+           }
        }
     }
     xml_config_read();
@@ -1286,6 +1297,7 @@ int check_options(int argc, char **argv)
     control_block.loglevel = yaz_log_mask_str(STAT_DEFAULT_LOG_LEVEL);
     yaz_log_init_level(control_block.loglevel);
 
+    get_logbits(1); 
     while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:",
                          argv, argc, &arg)) != -2)
     {
@@ -1329,6 +1341,7 @@ int check_options(int argc, char **argv)
            control_block.loglevel =
                yaz_log_mask_str_x(arg,control_block.loglevel);
            yaz_log_init(control_block.loglevel, me, control_block.logfile);
+           get_logbits(1); 
            break;
        case 'a':
            option_copy(control_block.apdufile, arg);
@@ -1396,7 +1409,6 @@ int check_options(int argc, char **argv)
            return 1;
         }
     }
-    get_logbits(1); 
     return 0;
 }