From f3da3b241cadda7e25c809e3d8049cee63d3418e Mon Sep 17 00:00:00 2001 From: Douglas Hall Date: Mon, 13 Nov 2017 16:56:30 -0500 Subject: [PATCH] Added logging to help debug Enterprise API issue. --- openedx/features/enterprise_support/api.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openedx/features/enterprise_support/api.py b/openedx/features/enterprise_support/api.py index d111a3931c..a300124d22 100644 --- a/openedx/features/enterprise_support/api.py +++ b/openedx/features/enterprise_support/api.py @@ -125,6 +125,7 @@ class EnterpriseApiClient(object): Initialize an authenticated Enterprise service API client by using the provided user. """ + self.user = user jwt = JwtBuilder(user).build_token([]) self.client = EdxRestApiClient( configuration_helpers.get_value('ENTERPRISE_API_URL', settings.ENTERPRISE_API_URL), @@ -247,10 +248,11 @@ class EnterpriseApiClient(object): querystring = {'username': user.username} response = endpoint().get(**querystring) except (HttpClientError, HttpServerError): - message = ("An error occurred while getting EnterpriseLearner data for user {username}".format( - username=user.username - )) - LOGGER.exception(message) + LOGGER.exception( + 'Failed to get enterprise-learner for user [%s] with client user [%s]', + user.username, + self.user.username + ) return None return response