Apache Solr open-source search software
SOLR-14523: Enhance gradle logging calls validation: eliminate getMessage(). Added Gradle validation check.
Erick Erickson743234ed8348
diff --git a/gradle/validation/validate-log-calls.gradle b/gradle/validation/validate-log-calls.gradleindex 76fee5af052..ebecaa2aa9c 100644--- a/gradle/validation/validate-log-calls.gradle+++ b/gradle/validation/validate-log-calls.gradle@@ -134,7 +134,10 @@ class ValidateLogCallsTask extends DefaultTask {violation = true}}-+ if (stripped.contains("getMessage()") || stripped.contains("getCause()")) {+ cause = "getMessage or getCause in log line";+ violation = true;+ }if (violation) {reportViolation(String.format("cause: '%s' Suspicious logging call, Parameterize and possibly surround with 'if (log.is*Enabled) {..}'. Help at: 'gradlew helpValidateLogCalls' %s %s:%d", cause , System.lineSeparator, file.getAbsolutePath(), lineNumber))