mirror of https://github.com/apache/lucene.git
SOLR-5672: Add logParamsList parameter to support reduced logging. Closes #23.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1565072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ed5b93abf
commit
3b43c10bd1
|
@ -176,6 +176,9 @@ New Features
|
||||||
* SOLR-5682: Make the admin InfoHandler more pluggable / derivable.
|
* SOLR-5682: Make the admin InfoHandler more pluggable / derivable.
|
||||||
(Greg Chanan via Mark Miller)
|
(Greg Chanan via Mark Miller)
|
||||||
|
|
||||||
|
* SOLR-5672: Add logParamsList parameter to support reduced logging.
|
||||||
|
(Christine Poerschke via Mark Miller)
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.io.InputStreamReader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -1932,7 +1933,14 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
// are expecting them during handleRequest
|
// are expecting them during handleRequest
|
||||||
toLog.add("webapp", req.getContext().get("webapp"));
|
toLog.add("webapp", req.getContext().get("webapp"));
|
||||||
toLog.add("path", req.getContext().get("path"));
|
toLog.add("path", req.getContext().get("path"));
|
||||||
|
|
||||||
|
final SolrParams params = req.getParams();
|
||||||
|
final String lpList = params.get(CommonParams.LOG_PARAMS_LIST);
|
||||||
|
if (lpList == null) {
|
||||||
toLog.add("params", "{" + req.getParamString() + "}");
|
toLog.add("params", "{" + req.getParamString() + "}");
|
||||||
|
} else if (lpList.length() > 0) {
|
||||||
|
toLog.add("params", "{" + params.toFilteredSolrParams(Arrays.asList(lpList.split(","))).toString() + "}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Put status, QTime, and possibly request handler and params, in the response header */
|
/** Put status, QTime, and possibly request handler and params, in the response header */
|
||||||
|
|
|
@ -181,6 +181,9 @@ public interface CommonParams {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** which parameters to log (if not supplied all parameters will be logged) **/
|
||||||
|
public static final String LOG_PARAMS_LIST = "logParamsList";
|
||||||
|
|
||||||
public static final String EXCLUDE = "ex";
|
public static final String EXCLUDE = "ex";
|
||||||
public static final String TAG = "tag";
|
public static final String TAG = "tag";
|
||||||
public static final String TERMS = "terms";
|
public static final String TERMS = "terms";
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.solr.common.params;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
|
@ -298,6 +299,21 @@ public abstract class SolrParams implements Serializable {
|
||||||
return new MapSolrParams(map);
|
return new MapSolrParams(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create filtered SolrParams. */
|
||||||
|
public SolrParams toFilteredSolrParams(List<String> names) {
|
||||||
|
NamedList<String> nl = new NamedList<String>();
|
||||||
|
for (Iterator<String> it = getParameterNamesIterator(); it.hasNext();) {
|
||||||
|
final String name = it.next();
|
||||||
|
if (names.contains(name)) {
|
||||||
|
final String[] values = getParams(name);
|
||||||
|
for (String value : values) {
|
||||||
|
nl.add(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toSolrParams(nl);
|
||||||
|
}
|
||||||
|
|
||||||
/** Convert this to a NamedList */
|
/** Convert this to a NamedList */
|
||||||
public NamedList<Object> toNamedList() {
|
public NamedList<Object> toNamedList() {
|
||||||
final SimpleOrderedMap<Object> result = new SimpleOrderedMap<Object>();
|
final SimpleOrderedMap<Object> result = new SimpleOrderedMap<Object>();
|
||||||
|
@ -315,11 +331,3 @@ public abstract class SolrParams implements Serializable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue