From 773777e61335a65c8a73969a0dc9503ab263d33f Mon Sep 17 00:00:00 2001 From: Thomas Draebing Date: Mon, 27 Jul 2020 12:44:10 +0200 Subject: [PATCH 1/3] Respect log.textLogging and log.jsonLogging using --console-log The gerrit.war daemon provides a --console-log flag to send the error logs to stderr. However, when using this flag, no logs were written to the error_log or error_log.json files, even if the corresponding option, log.textLogging or log.jsonLogging, was set in the gerrit.config file. On the one hand, the configuration should be respected and on the other hand, there are usecases, where both output channels are useful. Mainly, if Gerrit is run in a docker container, it is useful to be able to use 'docker logs' to view the current logs and to have the logs persisted at the same time. While one can tail the log-file to do so, Gerrit is then not the main process of the container and will thus not be gracefully shutdown, when stopping the container. Use the --console-log option together with {text|json}Logging to log to stderr and the error_log file without the need to tail the file to stdout. Note, that this will as a side effect change the default behaviour of the --console-log flag. Since the log.textLogging option is true by default, using the --console-log flag will now by default log to stderr and the error_log file. This can be prevented by setting log.textLogging to 'false'. Bug: Issue 13184 Change-Id: I5c3dfa531a6ccd397d3ceb60defc6e83943e95f1 --- Documentation/pgm-daemon.txt | 5 ++-- java/com/google/gerrit/pgm/Daemon.java | 4 +-- .../google/gerrit/pgm/util/ErrorLogFile.java | 25 +++++++++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Documentation/pgm-daemon.txt b/Documentation/pgm-daemon.txt index ad07cfac1f..25ca4dd706 100644 --- a/Documentation/pgm-daemon.txt +++ b/Documentation/pgm-daemon.txt @@ -49,8 +49,9 @@ per the local copy of link:config-gerrit.html[gerrit.config] located under This option automatically implies '--enable-sshd'. --console-log:: - Send log messages to the console, instead of to the standard - log file '$site_path/logs/error_log'. + Send log messages to the console. Log files will still be written to + the error log file, if log.textLogging and/or log.jsonLogging is set to + 'true'. --headless:: Don't start the default Gerrit UI. May be useful when Gerrit is diff --git a/java/com/google/gerrit/pgm/Daemon.java b/java/com/google/gerrit/pgm/Daemon.java index 65534770fe..d2371e896e 100644 --- a/java/com/google/gerrit/pgm/Daemon.java +++ b/java/com/google/gerrit/pgm/Daemon.java @@ -331,9 +331,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) { diff --git a/java/com/google/gerrit/pgm/util/ErrorLogFile.java b/java/com/google/gerrit/pgm/util/ErrorLogFile.java index 227719ab79..8eae82ac92 100644 --- a/java/com/google/gerrit/pgm/util/ErrorLogFile.java +++ b/java/com/google/gerrit/pgm/util/ErrorLogFile.java @@ -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,18 +68,28 @@ 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] [%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] [%t] %-5p %c %x: %m%n"), rotate)); + root.addAppender(SystemLog.createAppender(logdir, LOG_NAME, errorLogLayout, rotate)); } if (json) { From 40def8b495ca7d67dd9c982e8f975f50168f435c Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Tue, 4 Aug 2020 16:48:44 -0400 Subject: [PATCH 2/3] Document possibility to resume reviews with meetings In the context of the design doc review process, mention the possibility of resuming stalled reviews through meeting discussions. This may be used or referred to also in other review contexts. Change-Id: I45a1b5deb0311d049a9deffbf8b206c5d0524bc3 --- Documentation/dev-design-docs.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/dev-design-docs.txt b/Documentation/dev-design-docs.txt index be80c94686..a339da396a 100644 --- a/Documentation/dev-design-docs.txt +++ b/Documentation/dev-design-docs.txt @@ -127,6 +127,15 @@ link:dev-processes.html#steering-committee[engineering steering committee] within 14 calendar days whether the proposed feature is in scope of the project and if it can be accepted. +[[meetings]] +=== Meeting discussions + +If the Gerrit review doesn't start efficiently enough, stalls, gets off-track +too much or becomes overly complex, one can use a meeting to refocus it. From +that review thread, the organizer can volunteer oneself, or be proposed (even +requested) by a reviewer. link:https://www.gerritcodereview.com/members.html#community-managers[ +Community managers] may help facilitate that if ultimately necessary. + [[watch-designs]] == How to get notified for new design docs? From 7702e5f28723b5e05a41bf6f6dcee427af3811b6 Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Mon, 3 Aug 2020 17:54:38 -0400 Subject: [PATCH 3/3] Upgrade jackson-core to 2.11.2 Change-Id: Ibfe690fbbee3f79b2ac012326dfeb6dc9b4de886 --- tools/nongoogle.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/nongoogle.bzl b/tools/nongoogle.bzl index 0313116497..9c664310ad 100644 --- a/tools/nongoogle.bzl +++ b/tools/nongoogle.bzl @@ -100,8 +100,8 @@ def declare_nongoogle_deps(): maven_jar( name = "jackson-core", - artifact = "com.fasterxml.jackson.core:jackson-core:2.11.1", - sha1 = "8b02908d53183fdf9758e7e20f2fdee87613a962", + artifact = "com.fasterxml.jackson.core:jackson-core:2.11.2", + sha1 = "bc022ab0f0c83c07f9c52c5ab9a6a4932b15cc35", ) # Google internal dependencies: these are developed at Google, so there is