[DS-3832] Don't spew stack traces for simple exceptions.

This commit is contained in:
Mark H. Wood
2018-04-17 10:20:05 -04:00
parent 79d11cbe5b
commit 9d5910c010

View File

@@ -45,7 +45,6 @@ import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.log4j.Logger;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
@@ -89,6 +88,8 @@ import org.dspace.statistics.util.DnsLookup;
import org.dspace.statistics.util.LocationUtils; import org.dspace.statistics.util.LocationUtils;
import org.dspace.statistics.util.SpiderDetector; import org.dspace.statistics.util.SpiderDetector;
import org.dspace.usage.UsageWorkflowEvent; import org.dspace.usage.UsageWorkflowEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -102,7 +103,9 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author mdiggory at atmire.com * @author mdiggory at atmire.com
*/ */
public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBean { public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBean {
private static final Logger log = Logger.getLogger(SolrLoggerServiceImpl.class); private static final Logger log
= LoggerFactory.getLogger(SolrLoggerServiceImpl.class);
private static final String MULTIPLE_VALUES_SPLITTER = "|"; private static final String MULTIPLE_VALUES_SPLITTER = "|";
protected SolrServer solr; protected SolrServer solr;
@@ -358,7 +361,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
doc1.addField("longitude", longitude); doc1.addField("longitude", longitude);
} }
} catch (IOException | GeoIp2Exception e) { } catch (IOException | GeoIp2Exception e) {
log.error("Unable to get location of request", e); log.error("Unable to get location of request: {}", e.getMessage());
} }
} }
} }
@@ -445,7 +448,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
doc1.addField("longitude", longitude); doc1.addField("longitude", longitude);
} }
} catch (GeoIp2Exception | IOException e) { } catch (GeoIp2Exception | IOException e) {
log.error("Unable to get location of request", e); log.error("Unable to get location of request: {}", e.getMessage());
} }
} }
} }