Merge branch 'stable-3.2'
* stable-3.2: Preserve instanceId on event when already set Upgrade metrics-core to 4.1.12.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: Ib2bdb297908d0a90d7c51cd3fe14cdf377ead251
This commit is contained in:
@@ -347,9 +347,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) {
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user