ConsoleAppender<ILoggingEvent> console = new ConsoleAppender<ILoggingEvent>();
console.setContext(context);
console.setTarget("System.err");
console.setWithJansi(true);
PatternLayoutEncoder consolePat = new PatternLayoutEncoder();
consolePat.setContext(context);
consolePat.setPattern(CONSOLE_PATTERN);
consolePat.start();
console.setEncoder(consolePat);
root.addAppender(console);
if (logFile != null) {
String lstr = options.getString("log_level");
Level logLevel = Level.toLevel(lstr, Level.INFO);
FileAppender<ILoggingEvent> fileOutput = new FileAppender<ILoggingEvent>();
fileOutput.setAppend(false);
fileOutput.setContext(context);
fileOutput.setFile(logFile.getAbsolutePath());
PatternLayoutEncoder filePat = new PatternLayoutEncoder();
filePat.setContext(context);
filePat.setPattern(FILE_PATTERN);
filePat.start();
fileOutput.setEncoder(filePat);
fileOutput.start();
root.addAppender(fileOutput);
root.setLevel(logLevel);
if (!debug) {