Affected Versions: 1.3.X
Component: TraceFilter
In TraceFilter, there is a Log and throw:
...
try {
spanFromRequest = createSpan(request, skip, spanFromRequest, name);
filterChain.doFilter(request, new TraceHttpServletResponse(response, spanFromRequest));
} catch (Throwable e) {
exception = e;
errorParser().parseErrorTags(tracer().getCurrentSpan(), e);
if (log.isErrorEnabled()) {
log.error("Uncaught exception thrown", e);
}
throw e;
}
...
I think it would be better remove it, or, at least, to put it at DEBUG level.
Thanks
I disagree. It's put there deliberately to log uncaught exceptions. If you don't like it, you can register your own version of trace filter and not log it. You can also disable logging of trace filter.
@marcingrzejszczak Could we rethink it again? Current approach pollutes logs with ERROR messages, and proposed solution either adds maintenance burden (custom version of TraceFilter) or forces weird configuration setting (turning OFF all logs for given class).
Other well behaving Filters in the same situation don't log exceptions coming from downstream filters as ERROR. I think no Filter in org.springframework.web.filter does that.
This filter re-throws incoming error, so it's eventually caught in the call stack of the request, either by the container, or other filter which can do something meaningful to the exception.
Hmm I think you're using some ancient version of Sleuth cause in the latest ones you can just set spring.sleuth.web.exception-logging-filter-enabled to false.
Most helpful comment
@marcingrzejszczak Could we rethink it again? Current approach pollutes logs with ERROR messages, and proposed solution either adds maintenance burden (custom version of TraceFilter) or forces weird configuration setting (turning OFF all logs for given class).
Other well behaving Filters in the same situation don't log exceptions coming from downstream filters as ERROR. I think no Filter in
org.springframework.web.filterdoes that.This filter re-throws incoming error, so it's eventually caught in the call stack of the request, either by the container, or other filter which can do something meaningful to the exception.