From e1d2749b20a3b04beef08ab75a2c6deb4f2cdf41 Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Thu, 28 Jun 2018 14:47:33 +0100 Subject: [PATCH] SOLR-12419: standardise solr/contrib (private) logger names --- lucene/tools/src/groovy/check-source-patterns.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lucene/tools/src/groovy/check-source-patterns.groovy b/lucene/tools/src/groovy/check-source-patterns.groovy index f0007f56872..63541c20a57 100644 --- a/lucene/tools/src/groovy/check-source-patterns.groovy +++ b/lucene/tools/src/groovy/check-source-patterns.groovy @@ -66,6 +66,7 @@ def lineSplitter = ~$/[\r\n]+/$; def singleLineSplitter = ~$/\n\r?/$; def licenseMatcher = Defaults.createDefaultMatcher(); def validLoggerPattern = ~$/(?s)\b(private\s|static\s|final\s){3}+\s*Logger\s+\p{javaJavaIdentifierStart}+\s+=\s+\QLoggerFactory.getLogger(MethodHandles.lookup().lookupClass());\E/$; +def validLoggerNamePattern = ~$/(?s)\b(private\s|static\s|final\s){3}+\s*Logger\s+(log|LOG)+\s+=\s+\QLoggerFactory.getLogger(MethodHandles.lookup().lookupClass());\E/$; def packagePattern = ~$/(?m)^\s*package\s+org\.apache.*;/$; def xmlTagPattern = ~$/(?m)\s*<[a-zA-Z].*/$; def sourceHeaderPattern = ~$/\[source\b.*/$; @@ -169,6 +170,9 @@ ant.fileScanner{ if (!validLoggerPattern.matcher(text).find()) { reportViolation(f, 'invalid logging pattern [not private static final, uses static class name]'); } + if (f.toString().contains('solr/contrib') && !validLoggerNamePattern.matcher(text).find()) { + reportViolation(f, 'invalid logger name [not log or LOG]'); + } } checkLicenseHeaderPrecedes(f, 'package', packagePattern, javaCommentPattern, text, ratDocument); if (f.name.contains("Test")) {