+/** start_log: open a log file */
+/* FIXME - parse command line arguments to set log levels etc */
+static int loglevel=0;
+void start_log(int argc, char **argv)
+{
+ char logname[2048];
+ if (!argv)
+ return;
+ if (!argv[0])
+ return;
+ sprintf(logname, "%s.log", argv[0]);
+ yaz_log_init_file(logname);
+ loglevel = yaz_log_mask_str_x(argv[0],0);
+ yaz_log_init_level(LOG_DEFAULT_LEVEL | loglevel);
+ logf(loglevel,"starting %s",argv[0]);
+}
+
+/**
+ * start_up : do common start things, and a zebra_start
+ * - nmem_init
+ * - build the name of logfile from argv[0], and open it
+ * if no argv passed, do not open a log
+ * - read zebra.cfg from env var srcdir if it exists; otherwise current dir
+ * default to zebra.cfg, if no name is given
+ */
+ZebraService start_up(char *cfgname, int argc, char **argv)
+{
+ nmem_init();
+ start_log(argc, argv);
+ return start_service(cfgname);
+}