Permalink
Browse files

Fix for 14611: SolrJ client - Remove verbose error logging

  • Loading branch information...
1 parent 8705f48 commit cbe6733a84f1caa0cadaefbd0185b238e25992ad @kirktrue kirktrue committed Mar 15, 2013
Showing with 18 additions and 4 deletions.
  1. +18 −4 src/main/java/com/mustardgrain/solr/SolrClient.java
@@ -381,7 +381,7 @@ private Exception addZombie(HttpSolrServer server,
startAliveCheckExecutor();
if (LOG.isWarnEnabled())
- LOG.warn("Marking server " + wrapper.solrServer.getBaseURL() + " inactive; cause: " + e.getMessage(), e);
+ LOG.warn("Marking server " + wrapper.solrServer.getBaseURL() + " inactive - " + getNestedErrorMessages(e));
return e;
}
@@ -595,7 +595,7 @@ private void checkAZombieServer(ServerWrapper zombieServer) {
zombieServer.failedPings++;
if (LOG.isWarnEnabled())
- LOG.warn("Server " + zombieServer.solrServer.getBaseURL() + " still inactive after " + zombieServer.failedPings + " checks", e);
+ LOG.warn("Server " + zombieServer.solrServer.getBaseURL() + " still inactive after " + zombieServer.failedPings + " checks - " + getNestedErrorMessages(e));
// If the server doesn't belong in the standard set belonging to this load balancer
// then simply drop it after a certain number of failed pings.
@@ -613,7 +613,7 @@ private void moveAliveToDead(ServerWrapper wrapper, Throwable t) {
startAliveCheckExecutor();
if (LOG.isWarnEnabled())
- LOG.warn("Marking server " + wrapper.solrServer.getBaseURL() + " inactive; cause: " + t.getMessage(), t);
+ LOG.warn("Marking server " + wrapper.solrServer.getBaseURL() + " inactive - " + getNestedErrorMessages(t));
}
private int interval = CHECK_INTERVAL;
@@ -778,7 +778,7 @@ else if (error instanceof SolrException && ((SolrException)error).code() / 100 !
stats.httpFailures.incrementAndGet(); // Non 2xx HTTP return codes
if (LOG.isWarnEnabled())
- LOG.warn(error, error);
+ LOG.warn(getNestedErrorMessages(error));
}
private void updateStatsEmptyResults(HttpSolrServer server) {
@@ -803,6 +803,20 @@ private void updateStatsSuccess(HttpSolrServer server) {
return new HashMap<String, Stats>(serverStats);
}
+ private String getNestedErrorMessages(Throwable t) {
+ StringBuilder sb = new StringBuilder();
+
+ while (t != null) {
+ if (sb.length() > 0)
+ sb.append("; caused by: ");
+
+ sb.append(t.getMessage());
+ t = t.getCause();
+ }
+
+ return sb.toString();
+ }
+
public class Stats {
private final AtomicInteger successes = new AtomicInteger();

0 comments on commit cbe6733

Please sign in to comment.