From: Volker Theile Date: Wed, 21 Aug 2019 12:50:55 +0000 (+0200) Subject: mgr/dashboard: Improve RestClient error logging X-Git-Tag: v15.1.0~1722^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a2025dcfd5234f3604fba710cd895a1c88b8567;p=ceph.git mgr/dashboard: Improve RestClient error logging Log the request URL for ConnectionError exceptions to allow a better error analysis of bug reports. Signed-off-by: Volker Theile --- diff --git a/src/pybind/mgr/dashboard/rest_client.py b/src/pybind/mgr/dashboard/rest_client.py index e3f5dafc820..d81b61c3a52 100644 --- a/src/pybind/mgr/dashboard/rest_client.py +++ b/src/pybind/mgr/dashboard/rest_client.py @@ -436,8 +436,8 @@ class RestClient(object): errno = "n/a" strerror = "SSL error. Probably trying to access a non " \ "SSL connection." - logger.error("%s REST API failed %s, SSL error.", - self.client_name, method.upper()) + logger.error("%s REST API failed %s, SSL error (url=%s).", + self.client_name, method.upper(), ex.request.url) else: try: match = re.match(r'.*: \[Errno (-?\d+)\] (.+)', @@ -448,20 +448,21 @@ class RestClient(object): errno = match.group(1) strerror = match.group(2) logger.error( - "%s REST API failed %s, connection error: " + "%s REST API failed %s, connection error (url=%s): " "[errno: %s] %s", - self.client_name, method.upper(), errno, strerror) + self.client_name, method.upper(), ex.request.url, + errno, strerror) else: errno = "n/a" strerror = "n/a" logger.error( - "%s REST API failed %s, connection error.", - self.client_name, method.upper()) + "%s REST API failed %s, connection error (url=%s).", + self.client_name, method.upper(), ex.request.url) else: errno = "n/a" strerror = "n/a" - logger.error("%s REST API failed %s, connection error.", - self.client_name, method.upper()) + logger.error("%s REST API failed %s, connection error (url=%s).", + self.client_name, method.upper(), ex.request.url) if errno != "n/a": ex_msg = (