Commit f18aeab8 by Dave Syer

Replace some of the log/printStackTraces with ignores

Fixes gh-153
parent a45c0cce
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.cloud.netflix.feign; package org.springframework.cloud.netflix.feign;
import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
...@@ -23,7 +25,6 @@ import java.lang.reflect.Type; ...@@ -23,7 +25,6 @@ import java.lang.reflect.Type;
import javax.inject.Provider; import javax.inject.Provider;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
...@@ -36,12 +37,9 @@ import feign.Response; ...@@ -36,12 +37,9 @@ import feign.Response;
import feign.codec.DecodeException; import feign.codec.DecodeException;
import feign.codec.Decoder; import feign.codec.Decoder;
import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders;
/** /**
* @author Spencer Gibb * @author Spencer Gibb
*/ */
@CommonsLog
public class SpringDecoder implements Decoder { public class SpringDecoder implements Decoder {
@Autowired @Autowired
...@@ -93,7 +91,7 @@ public class SpringDecoder implements Decoder { ...@@ -93,7 +91,7 @@ public class SpringDecoder implements Decoder {
this.response.body().close(); this.response.body().close();
} }
catch (IOException ex) { catch (IOException ex) {
log.error("Error closing response body", ex); // Ignore exception on close...
} }
} }
......
...@@ -34,12 +34,10 @@ import com.netflix.zuul.ZuulFilter; ...@@ -34,12 +34,10 @@ import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.constants.ZuulConstants; import com.netflix.zuul.constants.ZuulConstants;
import com.netflix.zuul.constants.ZuulHeaders; import com.netflix.zuul.constants.ZuulHeaders;
import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.context.RequestContext;
import lombok.extern.apachecommons.CommonsLog;
/** /**
* @author Spencer Gibb * @author Spencer Gibb
*/ */
@CommonsLog
public class SendResponseFilter extends ZuulFilter { public class SendResponseFilter extends ZuulFilter {
private static DynamicBooleanProperty INCLUDE_DEBUG_HEADER = DynamicPropertyFactory private static DynamicBooleanProperty INCLUDE_DEBUG_HEADER = DynamicPropertyFactory
...@@ -149,17 +147,12 @@ public class SendResponseFilter extends ZuulFilter { ...@@ -149,17 +147,12 @@ public class SendResponseFilter extends ZuulFilter {
byte[] bytes = new byte[INITIAL_STREAM_BUFFER_SIZE.get()]; byte[] bytes = new byte[INITIAL_STREAM_BUFFER_SIZE.get()];
int bytesRead = -1; int bytesRead = -1;
while ((bytesRead = zin.read(bytes)) != -1) { while ((bytesRead = zin.read(bytes)) != -1) {
// TODO
// if (Debug.debugRequest() && !Debug.debugRequestHeadersOnly()) {
// Debug.addRequestDebug("OUTBOUND: < " + new String(bytes, 0, bytesRead));
// }
try { try {
out.write(bytes, 0, bytesRead); out.write(bytes, 0, bytesRead);
out.flush(); out.flush();
} }
catch (IOException ex) { catch (IOException ex) {
// ignore // ignore
log.debug("Error writing response", ex);
} }
// doubles buffer size if previous read filled it // doubles buffer size if previous read filled it
if (bytesRead == bytes.length) { if (bytesRead == bytes.length) {
......
...@@ -23,6 +23,7 @@ import java.util.Collection; ...@@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import org.codehaus.jackson.JsonFactory; import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonGenerator; import org.codehaus.jackson.JsonGenerator;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
...@@ -77,21 +78,23 @@ public class HystrixStreamTask implements ApplicationContextAware { ...@@ -77,21 +78,23 @@ public class HystrixStreamTask implements ApplicationContextAware {
this.jsonMetrics.drainTo(metrics); this.jsonMetrics.drainTo(metrics);
if (!metrics.isEmpty()) { if (!metrics.isEmpty()) {
if (log.isTraceEnabled()) {
log.trace("sending amqp metrics size: " + metrics.size()); log.trace("sending amqp metrics size: " + metrics.size());
}
for (String json : metrics) { for (String json : metrics) {
// TODO: batch all metrics to one message // TODO: batch all metrics to one message
try { try {
this.channel.send(json); this.channel.send(json);
} }
catch (Exception ex) { catch (Exception ex) {
log.error("Error sending json to channel", ex); if (log.isTraceEnabled()) {
log.trace("failed sending amqp metrics: " + ex.getMessage());
}
} }
} }
} }
} }
// @InboundChannelAdapter()
// TODO: move fixedRate to configuration
@Scheduled(fixedRateString = "${hystrix.stream.amqp.gatherRate:500}") @Scheduled(fixedRateString = "${hystrix.stream.amqp.gatherRate:500}")
public void gatherMetrics() { public void gatherMetrics() {
try { try {
......
...@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
...@@ -49,7 +50,6 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; ...@@ -49,7 +50,6 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Configuration @Configuration
@CommonsLog
public class HystrixDashboardConfiguration { public class HystrixDashboardConfiguration {
private static final String DEFAULT_TEMPLATE_LOADER_PATH = "classpath:/templates/"; private static final String DEFAULT_TEMPLATE_LOADER_PATH = "classpath:/templates/";
...@@ -209,7 +209,7 @@ public class HystrixDashboardConfiguration { ...@@ -209,7 +209,7 @@ public class HystrixDashboardConfiguration {
is.close(); is.close();
} }
catch (Exception ex) { catch (Exception ex) {
log.debug("Error closing input stream", ex); // ignore errors on close
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment