Merge branch 'stable-3.1' into stable-3.2

* stable-3.1:
  PrologOptions: Enable error logging for dryrun options when debug is enabled
  config-project-config.txt: reformat submit-section
  TestSubmitType: Enable logErrors when debug logging is enabled
  TestSubmitRule: Enable logErrors when debug logging is enabled
  Fix typos in test.submit_rule and test.submit_type examples
  RestApiServlet: Log JSON parse error at debug level

Change-Id: I7bd6bf5f4fd26b5853b8c1594d39ed7e7f51a223
This commit is contained in:
David Pursehouse
2020-06-18 21:11:30 +09:00
4 changed files with 27 additions and 15 deletions

View File

@@ -601,6 +601,7 @@ public class RestApiServlet extends HttpServlet {
}
} catch (MalformedJsonException | JsonParseException e) {
cause = Optional.of(e);
logger.atFine().withCause(e).log("REST call failed on JSON parsing");
responseBytes =
replyError(
req, res, statusCode = SC_BAD_REQUEST, "Invalid " + JSON_TYPE + " in request", e);

View File

@@ -15,18 +15,21 @@
package com.google.gerrit.server.rules;
import com.google.auto.value.AutoValue;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
import java.util.Optional;
@AutoValue
public abstract class PrologOptions {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
public static PrologOptions defaultOptions() {
return new AutoValue_PrologOptions.Builder().logErrors(true).skipFilters(false).build();
}
public static PrologOptions dryRunOptions(String ruleToTest, boolean skipFilters) {
return new AutoValue_PrologOptions.Builder()
.logErrors(false)
.logErrors(logger.atFine().isEnabled())
.skipFilters(skipFilters)
.rule(ruleToTest)
.build();