Closed wmacomber closed 4 years ago
There is not a really a way to ignore the stacktrace.
You could set the log level for the appropriate logger to CRITICAL
but obviously this would remove all log messages not just the stack trace (logging.getLogger('LogProcessingWorker').setLevel(logging.CRITICAL)
).
A better solution could be to try catch known network exceptions (like connection refused and timeout) and log those without stacktrace. If you are interested, feel free.
What is the recommended way to catch when the connection to the Logstash endpoint is refused? I'd really like to be able to catch this and just locally log "CONNECTION REFUSED" rather than display 17 lines of backtrace that aren't going to help me. The connection was refused in this case because I deliberately pointed it at the wrong endpoint to trigger the errors, but the same principal applies to whenever it cannot make a connection to the Logstash endpoint.