Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-2124: do not log stack trace for Service Disabled / 503

James Dyer255f763640c6
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2d85b5eeaba..6362fcab2b5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -690,7 +690,10 @@ Bug Fixes
package name (org.apache.commons.csv). This created a compatibility issue as
the Apache Commons team works toward an official release of Commons CSV.
JARJAR (http://code.google.com/p/jarjar/) was used to change the package name
- to org.apache.solr.internal.csv. (Uwe Schindler, Emmanuel Bourg)
+ to org.apache.solr.internal.csv. (Uwe Schindler, Emmanuel Bourg)
+
+* SOLR-2124: Do not log stack traces for "Service Disabled" / 503 Exceptions (PingRequestHandler, etc)
+ (James Dyer, others)
Other Changes
----------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrException.java b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
index 16a8c9db650..9c9c8decef1 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrException.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
@@ -75,6 +75,10 @@ public class SolrException extends RuntimeException {
public void log(Logger log) { log(log,this); }
public static void log(Logger log, Throwable e) {
+ if (e instanceof SolrException
+ && ((SolrException) e).code() == ErrorCode.SERVICE_UNAVAILABLE.code) {
+ return;
+ }
String stackTrace = toStr(e);
String ignore = doIgnore(e, stackTrace);
if (ignore != null) {
@@ -86,6 +90,10 @@ public class SolrException extends RuntimeException {
}
public static void log(Logger log, String msg, Throwable e) {
+ if (e instanceof SolrException
+ && ((SolrException) e).code() == ErrorCode.SERVICE_UNAVAILABLE.code) {
+ log(log, msg);
+ }
String stackTrace = msg + ':' + toStr(e);
String ignore = doIgnore(e, stackTrace);
if (ignore != null) {
@@ -109,7 +117,7 @@ public class SolrException extends RuntimeException {
@Override
public String toString() { return super.toString(); }
- public static String toStr(Throwable e) {
+ public static String toStr(Throwable e) {
CharArrayWriter cw = new CharArrayWriter();
PrintWriter pw = new PrintWriter(cw);
e.printStackTrace(pw);