Extend debug logging
Add additional debug logs to provide more detailed information
about forwarded data between the primary and secondary instances:
- For each forwarding request sent from the primary
- For each event request received on the secondary
- For each index operation received on the secondary
A debug log already existed for cache eviction received on the
secondary instance.
Change-Id: I4ba720b38d64edb6a8967194e023c7b6e88a2b99
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/AbstractIndexRestApiServlet.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/AbstractIndexRestApiServlet.java
index fca807f..5641961 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/AbstractIndexRestApiServlet.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/AbstractIndexRestApiServlet.java
@@ -79,6 +79,7 @@
rsp.setCharacterEncoding(UTF_8.name());
String path = req.getPathInfo();
T id = parse(path.substring(path.lastIndexOf('/') + 1));
+ logger.debug("{} {} {}", operation.name(), type, id);
try {
Context.setForwardedEvent(true);
AtomicInteger idLock = getAndIncrementIdLock(id);
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/EventRestApiServlet.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/EventRestApiServlet.java
index 677d2eb..da08a83 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/EventRestApiServlet.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/EventRestApiServlet.java
@@ -66,6 +66,7 @@
return;
}
Event event = getEventFromRequest(req);
+ logger.debug("event {}", event.getType());
dispatcher.postEvent(event);
rsp.setStatus(SC_NO_CONTENT);
} catch (OrmException e) {
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/RestForwarder.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/RestForwarder.java
index 18c8645..c937e66 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/RestForwarder.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/RestForwarder.java
@@ -123,10 +123,12 @@
}
boolean execute() {
+ log.debug(name);
for (; ; ) {
try {
execCnt++;
tryOnce();
+ log.debug("{} OK", name);
return true;
} catch (ForwardingException e) {
if (!e.isRecoverable()) {