mirror of https://github.com/apache/lucene.git
SOLR-8186: suppress log4j access warnings.
This commit is contained in:
parent
53981795fd
commit
9e09045a4c
|
@ -56,6 +56,7 @@ import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.SolrException.ErrorCode;
|
import org.apache.solr.common.SolrException.ErrorCode;
|
||||||
import org.apache.solr.common.cloud.SolrZkClient;
|
import org.apache.solr.common.cloud.SolrZkClient;
|
||||||
import org.apache.solr.common.util.ExecutorUtil;
|
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.CoreContainer;
|
||||||
import org.apache.solr.core.NodeConfig;
|
import org.apache.solr.core.NodeConfig;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
|
@ -123,14 +124,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
|
||||||
{
|
{
|
||||||
String muteConsole = System.getProperty(SOLR_LOG_MUTECONSOLE);
|
String muteConsole = System.getProperty(SOLR_LOG_MUTECONSOLE);
|
||||||
if (muteConsole != null && !Arrays.asList("false","0","off","no").contains(muteConsole.toLowerCase(Locale.ROOT))) {
|
if (muteConsole != null && !Arrays.asList("false","0","off","no").contains(muteConsole.toLowerCase(Locale.ROOT))) {
|
||||||
Enumeration appenders = LogManager.getRootLogger().getAllAppenders();
|
muteConsole();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.info("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader());
|
log.info("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader());
|
||||||
|
|
||||||
|
@ -167,6 +161,18 @@ public class SolrDispatchFilter extends BaseSolrFilter {
|
||||||
log.info("SolrDispatchFilter.init() done");
|
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
|
* Override this to change CoreContainer initialization
|
||||||
* @return a CoreContainer to hold this server's cores
|
* @return a CoreContainer to hold this server's cores
|
||||||
|
|
Loading…
Reference in New Issue