Auto merge of #3154 - micbou:reduce-logging-verbosity-connection-error, r=puremourning

[READY] Reduce logging verbosity when a connection error occurs

Logging `ConnectionError` as an exception results in writing a Python traceback of 64 lines in the logs. Not only this messes up the logs, this also considerably increases their size for no good reason. Instead, we should log the exception as an error. This gives us something like
```
2018-09-24 11:19:27,487 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=27810): Max retries exceeded with url: /ready (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.HTTPConnection object at 0x0000000005CC7B70>, 'Connection to 127.0.0.1 timed out. (connect timeout=0.01)'))
```
which is much more reasonable.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/3154)
<!-- Reviewable:end -->
This commit is contained in:
zzbot 2018-10-07 11:47:52 -07:00 committed by GitHub
commit 738668319f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,11 +83,11 @@ class BaseRequest( object ):
else: else:
_IgnoreExtraConfFile( e.extra_conf_file ) _IgnoreExtraConfFile( e.extra_conf_file )
self._should_resend = True self._should_resend = True
except BaseRequest.Requests().exceptions.ConnectionError: except BaseRequest.Requests().exceptions.ConnectionError as e:
# We don't display this exception to the user since it is likely to happen # We don't display this exception to the user since it is likely to happen
# for each subsequent request (typically if the server crashed) and we # for each subsequent request (typically if the server crashed) and we
# don't want to spam the user with it. # don't want to spam the user with it.
_logger.exception( 'Unable to connect to server' ) _logger.error( e )
except Exception as e: except Exception as e:
_logger.exception( 'Error while handling server response' ) _logger.exception( 'Error while handling server response' )
if display_message: if display_message: