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:
@@ -135,6 +135,16 @@ link:dev-processes.html#steering-committee[engineering steering
|
||||
committee] within 30 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,role=external,window=_blank] may help facilitate that if
|
||||
ultimately necessary.
|
||||
|
||||
[[watch-designs]]
|
||||
== How to get notified for new design docs?
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.entities.BranchNameKey;
|
||||
@@ -111,7 +112,7 @@ public class EventBroker implements EventDispatcher {
|
||||
}
|
||||
|
||||
protected void fireEvent(Change change, ChangeEvent event) throws PermissionBackendException {
|
||||
setInstanceId(event);
|
||||
setInstanceIdWhenEmpty(event);
|
||||
for (PluginSetEntryContext<UserScopedEventListener> c : listeners) {
|
||||
CurrentUser user = c.call(UserScopedEventListener::getUser);
|
||||
if (isVisibleTo(change, user)) {
|
||||
@@ -122,7 +123,7 @@ public class EventBroker implements EventDispatcher {
|
||||
}
|
||||
|
||||
protected void fireEvent(Project.NameKey project, ProjectEvent event) {
|
||||
setInstanceId(event);
|
||||
setInstanceIdWhenEmpty(event);
|
||||
for (PluginSetEntryContext<UserScopedEventListener> c : listeners) {
|
||||
|
||||
CurrentUser user = c.call(UserScopedEventListener::getUser);
|
||||
@@ -135,7 +136,7 @@ public class EventBroker implements EventDispatcher {
|
||||
|
||||
protected void fireEvent(BranchNameKey branchName, RefEvent event)
|
||||
throws PermissionBackendException {
|
||||
setInstanceId(event);
|
||||
setInstanceIdWhenEmpty(event);
|
||||
for (PluginSetEntryContext<UserScopedEventListener> c : listeners) {
|
||||
CurrentUser user = c.call(UserScopedEventListener::getUser);
|
||||
if (isVisibleTo(branchName, user)) {
|
||||
@@ -146,7 +147,7 @@ public class EventBroker implements EventDispatcher {
|
||||
}
|
||||
|
||||
protected void fireEvent(Event event) throws PermissionBackendException {
|
||||
setInstanceId(event);
|
||||
setInstanceIdWhenEmpty(event);
|
||||
for (PluginSetEntryContext<UserScopedEventListener> c : listeners) {
|
||||
CurrentUser user = c.call(UserScopedEventListener::getUser);
|
||||
if (isVisibleTo(event, user)) {
|
||||
@@ -156,9 +157,11 @@ public class EventBroker implements EventDispatcher {
|
||||
fireEventForUnrestrictedListeners(event);
|
||||
}
|
||||
|
||||
protected void setInstanceId(Event event) {
|
||||
protected void setInstanceIdWhenEmpty(Event event) {
|
||||
if (Strings.isNullOrEmpty(event.instanceId)) {
|
||||
event.instanceId = gerritInstanceId;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isVisibleTo(Project.NameKey project, CurrentUser user) {
|
||||
try {
|
||||
|
||||
@@ -19,10 +19,19 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
|
||||
import com.google.gerrit.acceptance.TestPlugin;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.extensions.registration.DynamicItem;
|
||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||
import com.google.gerrit.server.config.GerritInstanceId;
|
||||
import com.google.gerrit.server.events.Event;
|
||||
import com.google.gerrit.server.events.EventDispatcher;
|
||||
import com.google.gerrit.server.events.EventListener;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Scopes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
|
||||
@TestPlugin(
|
||||
@@ -35,6 +44,8 @@ public class InstanceIdFromPluginIT extends LightweightPluginDaemonTest {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(InstanceIdLoader.class).in(Scopes.SINGLETON);
|
||||
bind(TestEventListener.class).in(Scopes.SINGLETON);
|
||||
DynamicSet.bind(binder(), EventListener.class).to(TestEventListener.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +58,27 @@ public class InstanceIdFromPluginIT extends LightweightPluginDaemonTest {
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestEventListener implements EventListener {
|
||||
private final List<Event> events = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
events.add(event);
|
||||
}
|
||||
|
||||
public List<Event> getEvents() {
|
||||
return events;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestEvent extends Event {
|
||||
|
||||
protected TestEvent(String instanceId) {
|
||||
super("test");
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@GerritConfig(name = "gerrit.instanceId", value = "testInstanceId")
|
||||
public void shouldReturnInstanceIdWhenDefined() {
|
||||
@@ -58,6 +90,21 @@ public class InstanceIdFromPluginIT extends LightweightPluginDaemonTest {
|
||||
assertThat(getInstanceIdLoader().gerritInstanceId).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@GerritConfig(name = "gerrit.instanceId", value = "testInstanceId")
|
||||
public void shouldPreserveEventInstanceIdWhenDefined() throws PermissionBackendException {
|
||||
EventDispatcher dispatcher =
|
||||
plugin.getSysInjector().getInstance(new Key<DynamicItem<EventDispatcher>>() {}).get();
|
||||
String eventInstanceId = "eventInstanceId";
|
||||
TestEventListener eventListener = plugin.getSysInjector().getInstance(TestEventListener.class);
|
||||
TestEvent testEvent = new TestEvent(eventInstanceId);
|
||||
|
||||
dispatcher.postEvent(testEvent);
|
||||
List<Event> receivedEvents = eventListener.getEvents();
|
||||
assertThat(receivedEvents).hasSize(1);
|
||||
assertThat(receivedEvents.get(0).instanceId).isEqualTo(eventInstanceId);
|
||||
}
|
||||
|
||||
private InstanceIdLoader getInstanceIdLoader() {
|
||||
return plugin.getSysInjector().getInstance(InstanceIdLoader.class);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ def declare_nongoogle_deps():
|
||||
|
||||
maven_jar(
|
||||
name = "dropwizard-core",
|
||||
artifact = "io.dropwizard.metrics:metrics-core:4.1.11",
|
||||
sha1 = "7f05969f40bf7296eac0dbb36c78ada28bf975f6",
|
||||
artifact = "io.dropwizard.metrics:metrics-core:4.1.12.1",
|
||||
sha1 = "cb2f351bf4463751201f43bb99865235d5ba07ca",
|
||||
)
|
||||
|
||||
SSHD_VERS = "2.4.0"
|
||||
@@ -102,8 +102,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
|
||||
|
||||
Reference in New Issue
Block a user