lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject [07/12] lucene-solr:branch_6x: SOLR-8186: suppress log4j access warnings.
Date Thu, 22 Sep 2016 07:52:15 GMT
SOLR-8186: suppress log4j access warnings.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/0a24afdc
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/0a24afdc
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/0a24afdc

Branch: refs/heads/branch_6x
Commit: 0a24afdc5b51fb0275a168ee502555bf06d91ff5
Parents: 8984e73
Author: Dawid Weiss <dweiss@apache.org>
Authored: Thu Sep 22 09:33:11 2016 +0200
Committer: Dawid Weiss <dweiss@apache.org>
Committed: Thu Sep 22 09:51:22 2016 +0200

----------------------------------------------------------------------
 .../apache/solr/servlet/SolrDispatchFilter.java | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0a24afdc/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
index 53998fa..a32a70a 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -56,6 +56,7 @@ import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.util.ExecutorUtil;
+import org.apache.solr.common.util.SuppressForbidden;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.NodeConfig;
 import org.apache.solr.core.SolrCore;
@@ -123,14 +124,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
   {
     String muteConsole = System.getProperty(SOLR_LOG_MUTECONSOLE);
     if (muteConsole != null && !Arrays.asList("false","0","off","no").contains(muteConsole.toLowerCase(Locale.ROOT)))
{
-      Enumeration appenders = LogManager.getRootLogger().getAllAppenders();
-      while (appenders.hasMoreElements()) {
-        Appender appender = (Appender) appenders.nextElement();
-        if (appender instanceof ConsoleAppender) {
-          log.info("Property solr.log.muteconsole given. Muting ConsoleAppender named " +
appender.getName());
-          LogManager.getRootLogger().removeAppender(appender);
-        }
-      }
+      muteConsole();
     }
     log.info("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader());
 
@@ -167,6 +161,18 @@ public class SolrDispatchFilter extends BaseSolrFilter {
     log.info("SolrDispatchFilter.init() done");
   }
 
+  @SuppressForbidden(reason = "Legitimate log4j access")
+  private void muteConsole() {
+    Enumeration appenders = LogManager.getRootLogger().getAllAppenders();
+    while (appenders.hasMoreElements()) {
+      Appender appender = (Appender) appenders.nextElement();
+      if (appender instanceof ConsoleAppender) {
+        log.info("Property solr.log.muteconsole given. Muting ConsoleAppender named " + appender.getName());
+        LogManager.getRootLogger().removeAppender(appender);
+      }
+    }
+  }
+
   /**
    * Override this to change CoreContainer initialization
    * @return a CoreContainer to hold this server's cores


Mime
View raw message