You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/07/04 13:38:49 UTC

[lucene-solr] branch master updated: SOLR-14523: Enhance gradle logging calls validation: eliminate getMessage(). Added Gradle validation check.

This is an automated email from the ASF dual-hosted git repository.

erick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 743234e  SOLR-14523: Enhance gradle logging calls validation: eliminate getMessage(). Added Gradle validation check.
743234e is described below

commit 743234ed8348e36b81eec1dc4301e5d1623da87e
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Sat Jul 4 09:38:41 2020 -0400

    SOLR-14523: Enhance gradle logging calls validation: eliminate getMessage(). Added Gradle validation check.
---
 gradle/validation/validate-log-calls.gradle | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gradle/validation/validate-log-calls.gradle b/gradle/validation/validate-log-calls.gradle
index 76fee5a..ebecaa2 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))