SOLR-14523: Enhance gradle logging calls validation: eliminate getMessage(). Added Gradle validation check.

This commit is contained in:
Erick Erickson 2020-07-04 09:38:41 -04:00
parent c3d6a8bf7a
commit 743234ed83

View File

@ -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))