package org.endeavourhealth.hl7receiver;

import org.endeavourhealth.hl7receiver.hl7.HL7Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {

	private static final String PROGRAM_DISPLAY_NAME = "EDS HL7 receiver";
	private static final Logger LOG = LoggerFactory.getLogger(Main.class);

	public static void main(String[] args) {
		try {
            Configuration configuration = Configuration.getInstance();

		    LOG.info("--------------------------------------------------");
            LOG.info(PROGRAM_DISPLAY_NAME);
            LOG.info("--------------------------------------------------");

			HL7Service serviceManager = new HL7Service(configuration);
            serviceManager.start();

            LOG.info("Press any key to exit...");

            System.in.read();

            LOG.info("Shutting down...");
            serviceManager.stop();

            LOG.info("Shutdown");
            System.exit(0);

        } catch (Exception e) {
			LOG.error("Fatal exception occurred", e);
			System.exit(-1);
		}
	}
}
@@ -35,16 +35,84 @@
 eiver;%0A%0A
+import org.endeavourhealth.core.data.config.ConfigManagerException;%0A
 import o
@@ -1026,16 +1026,319 @@
        %7D
+ catch (ConfigManagerException cme) %7B%0A            System.err.println(%22Fatal exception occurred initializing ConfigManager %5B%22 + cme.getClass().getName() + %22%5D %22 + cme.getMessage());%0A%09%09    LOG.error(%22Fatal exception occurred initializing ConfigManager%22, cme);%0A            System.exit(-2);%0A        %7D%0A       
  catch (

Add specific handler for ConfigManager exceptions (where logback may not have been initialised)