use of org.restlet.ext.slf4j.Slf4jLoggerFacade in project openems by OpenEMS.
the class App method main.
// public final static String OPENEMS_VERSION = "2018.5.0-SNAPSHOT";
public static void main(String[] args) {
log.info("OpenEMS version [" + OPENEMS_VERSION + "] started");
// parse cli
Option helpOption = Option.builder("h").longOpt("help").required(false).desc("shows this message").build();
Option configFileOption = Option.builder("c").longOpt("configFile").numberOfArgs(1).required(false).type(String.class).desc("path for the configFile").build();
Options options = new Options();
options.addOption(helpOption);
options.addOption(configFileOption);
CommandLineParser parser = new DefaultParser();
CommandLine cmdLine;
String configPath = null;
try {
cmdLine = parser.parse(options, args);
if (cmdLine.hasOption("help")) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("openEMS", options);
System.exit(0);
} else {
configPath = cmdLine.hasOption("configFile") ? (String) cmdLine.getParsedOptionValue("configFile") : null;
}
} catch (ParseException e1) {
log.error("cli parsing failed!", e1);
}
// kick the watchdog: READY
SDNotify.sendNotify();
// configure Restlet logging
Engine.getInstance().setLoggerFacade(new Slf4jLoggerFacade());
// Get config
try {
Config config = Config.initialize(configPath);
config.readConfigFile();
} catch (Exception e) {
App.shutdownWithError("OpenEMS Edge start failed", e);
}
log.info("OpenEMS Edge started");
log.info("================================================================================");
}
Aggregations