Merge branch 'stable-3.1' into stable-3.2

* branch 'stable-3.1':
  Upgrade jackson-core to 2.11.2
  Document possibility to resume reviews with meetings
  Respect log.textLogging and log.jsonLogging using --console-log

Change-Id: I3a881dea55dc7413a7f00e309ba263282e4aa0b8
This commit is contained in:
Thomas Draebing
2020-08-06 10:37:27 +02:00
committed by Luca Milanesio
5 changed files with 36 additions and 18 deletions

View File

@@ -346,9 +346,7 @@ public class Daemon extends SiteProgram {
sysInjector.getInstance(PluginGuiceEnvironment.class).setDbCfgInjector(dbInjector, cfgInjector);
manager.add(dbInjector, cfgInjector, sysInjector);
if (!consoleLog) {
manager.add(ErrorLogFile.start(getSitePath(), config));
}
manager.add(ErrorLogFile.start(getSitePath(), config, consoleLog));
sshd &= !sshdOff();
if (sshd) {

View File

@@ -49,11 +49,12 @@ public class ErrorLogFile {
root.addAppender(dst);
}
public static LifecycleListener start(Path sitePath, Config config) throws IOException {
public static LifecycleListener start(Path sitePath, Config config, boolean consoleLog)
throws IOException {
Path logdir =
FileUtil.mkdirsOrDie(new SitePaths(sitePath).logs_dir, "Cannot create log directory");
if (SystemLog.shouldConfigure()) {
initLogSystem(logdir, config);
initLogSystem(logdir, config, consoleLog);
}
return new LifecycleListener() {
@@ -67,22 +68,30 @@ public class ErrorLogFile {
};
}
private static void initLogSystem(Path logdir, Config config) {
private static void initLogSystem(Path logdir, Config config, boolean consoleLog) {
Logger root = LogManager.getRootLogger();
root.removeAllAppenders();
PatternLayout errorLogLayout =
new PatternLayout(
"[%d{" + LogTimestampFormatter.TIMESTAMP_FORMAT + "}] [%t] %-5p %c %x: %m%n");
if (consoleLog) {
ConsoleAppender dst = new ConsoleAppender();
dst.setLayout(errorLogLayout);
dst.setTarget("System.err");
dst.setThreshold(Level.INFO);
dst.activateOptions();
root.addAppender(dst);
}
boolean json = config.getBoolean("log", "jsonLogging", false);
boolean text = config.getBoolean("log", "textLogging", true) || !json;
boolean text = config.getBoolean("log", "textLogging", true) || !(json || consoleLog);
boolean rotate = config.getBoolean("log", "rotate", true);
if (text) {
root.addAppender(
SystemLog.createAppender(
logdir,
LOG_NAME,
new PatternLayout(
"[%d{" + LogTimestampFormatter.TIMESTAMP_FORMAT + "}] [%t] %-5p %c %x: %m%n"),
rotate));
root.addAppender(SystemLog.createAppender(logdir, LOG_NAME, errorLogLayout, rotate));
}
if (json) {