mirror of https://github.com/apache/lucene.git
SOLR-15011: /admin/logging now distributes setLevel to all nodes (#2230)
The admin UI will set nodes=all for this. Co-authored-by: Nazerke Seidan <nseidan@salesforce.com> Co-authored-by: David Smiley <dsmiley@apache.org>
This commit is contained in:
parent
8d0cbcbb53
commit
6509a3003c
|
@ -72,6 +72,9 @@ Improvements
|
|||
* SOLR-14949: Docker: Ability to customize the FROM image when building.
|
||||
(Houston Putman)
|
||||
|
||||
* SOLR-15011: /admin/logging handler will now propagate setLevel (log threshold) to all nodes
|
||||
when told to. The admin UI now tells it to. (Nazerke Seidan, David Smiley)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
* SOLR-14656: Autoscaling framework removed (Ishan Chattopadhyaya, noble, Ilan Ginzburg)
|
||||
|
|
|
@ -111,8 +111,8 @@ public class AdminHandlersProxy {
|
|||
log.warn("Timeout when fetching result from node {}", entry.getKey(), te);
|
||||
}
|
||||
}
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("Fetched response from {} nodes: {}", responses.keySet().size(), responses.keySet());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Fetched response from {} nodes: {}", responses.keySet().size(), responses.keySet());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -49,13 +49,15 @@ public class LoggingHandler extends RequestHandlerBase implements SolrCoreAware
|
|||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private LogWatcher watcher;
|
||||
private final CoreContainer cc;
|
||||
|
||||
public LoggingHandler(CoreContainer cc) {
|
||||
this.cc = cc;
|
||||
this.watcher = cc.getLogging();
|
||||
}
|
||||
|
||||
public LoggingHandler() {
|
||||
|
||||
this.cc = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,6 +153,9 @@ public class LoggingHandler extends RequestHandlerBase implements SolrCoreAware
|
|||
rsp.add("loggers", info);
|
||||
}
|
||||
rsp.setHttpCaching(false);
|
||||
if (cc != null && AdminHandlersProxy.maybeProxyToNodes(req, rsp, cc)) {
|
||||
return; // Request was proxied to other node
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////// SolrInfoMBeans methods //////////////////////
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.solr.handler.admin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -27,12 +28,17 @@ import org.apache.lucene.util.IOUtils;
|
|||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.client.solrj.request.GenericSolrRequest;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.client.solrj.response.SimpleSolrResponse;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.SimpleOrderedMap;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -91,6 +97,32 @@ public class AdminHandlersProxyTest extends SolrCloudTestCase {
|
|||
assertNotNull(((NamedList)nl.get(nl.getName(1))).get("metrics"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void proxyLoggingHandlerAllNodes() throws IOException, SolrServerException {
|
||||
CollectionAdminRequest.createCollection("collection", "conf", 2, 2).process(solrClient);
|
||||
ModifiableSolrParams mparams = new ModifiableSolrParams();
|
||||
|
||||
mparams.set(CommonParams.QT, "/admin/logging");
|
||||
mparams.set("nodes", "all");
|
||||
mparams.set("set", "com.codahale.metrics.jmx.JmxReporter:WARN");
|
||||
solrClient.query("collection", mparams, SolrRequest.METHOD.GET);
|
||||
|
||||
Set<String> nodes = solrClient.getClusterStateProvider().getLiveNodes();
|
||||
nodes.forEach(node -> {
|
||||
mparams.clear();
|
||||
mparams.set(CommonParams.QT, "/admin/logging");
|
||||
mparams.set("nodes", node);
|
||||
QueryResponse rsp = null;
|
||||
try {
|
||||
rsp = solrClient.query("collection", mparams, SolrRequest.METHOD.GET);
|
||||
} catch (Exception e) {
|
||||
fail("Exception while proxying request to node " + node);
|
||||
}
|
||||
NamedList<Object> nl = rsp.getResponse();
|
||||
assertEquals("WARN", ((SimpleOrderedMap) ((ArrayList)nl.get("loggers")).get(5)).get("level"));
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = SolrException.class)
|
||||
public void proxySystemInfoHandlerNonExistingNode() throws IOException, SolrServerException {
|
||||
MapSolrParams params = new MapSolrParams(Collections.singletonMap("nodes", "example.com:1234_solr"));
|
||||
|
|
|
@ -38,6 +38,7 @@ When you select **Level**, you see the following menu:
|
|||
image::images/logging/level_menu.png[image,width=1159,height=577]
|
||||
|
||||
Directories are shown with their current logging levels. The Log Level Menu floats over these. To set a log level for a particular directory, select it and click the appropriate log level button.
|
||||
The log level change will be distributed to all nodes in the cluster.
|
||||
|
||||
Log levels settings are as follows:
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ solrAdminServices.factory('System',
|
|||
return $resource('admin/info/logging', {'wt':'json', '_':Date.now()}, {
|
||||
"events": {params: {since:'0'}},
|
||||
"levels": {},
|
||||
"setLevel": {}
|
||||
"setLevel": {params: {nodes:'all'}}
|
||||
});
|
||||
}])
|
||||
.factory('Zookeeper',
|
||||
|
|
Loading…
Reference in New Issue