Merge "Allow to control the Gerrit log level for running tests from system var"

This commit is contained in:
David Pursehouse
2019-11-28 23:09:12 +00:00
committed by Gerrit Code Review

View File

@@ -269,7 +269,7 @@ public class GerritServer implements AutoCloseable {
private static final ImmutableMap<String, Level> LOG_LEVELS =
ImmutableMap.<String, Level>builder()
.put("com.google.gerrit", Level.INFO)
.put("com.google.gerrit", getGerritLogLevel())
// Silence non-critical messages from MINA SSHD.
.put("org.apache.mina", Level.WARN)
@@ -307,6 +307,14 @@ public class GerritServer implements AutoCloseable {
.put("org.eclipse.jgit.util.FS", Level.WARN)
.build();
private static Level getGerritLogLevel() {
String value = Strings.nullToEmpty(System.getenv("GERRIT_LOG_LEVEL"));
if (value.isEmpty()) {
value = Strings.nullToEmpty(System.getProperty("gerrit.logLevel"));
}
return Level.toLevel(value, Level.INFO);
}
private static boolean forceLocalDisk() {
String value = Strings.nullToEmpty(System.getenv("GERRIT_FORCE_LOCAL_DISK"));
if (value.isEmpty()) {