From 7ba2c5e7bea79e49c87c871b364d0ba9c9f11659 Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Tue, 26 Nov 2024 14:00:19 +0500 Subject: [PATCH] fix: update loging message update loging message copy by adding exception message for debugging SONIC-794 --- commerce_coordinator/apps/lms/clients.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commerce_coordinator/apps/lms/clients.py b/commerce_coordinator/apps/lms/clients.py index 6e9d06757..6ed3eab0a 100644 --- a/commerce_coordinator/apps/lms/clients.py +++ b/commerce_coordinator/apps/lms/clients.py @@ -1,6 +1,7 @@ """ API clients for LMS app. """ +import json as Json from celery.utils.log import get_task_logger from django.conf import settings from requests.exceptions import RequestException @@ -119,7 +120,8 @@ def post(self, url, json, line_item_state_payload, logging_obj, timeout=None): **fulfill_line_item_state_payload ) logger.info( - f"Unsuccessful fulfillment for user: {logging_obj['user']} with details: " + f"Unsuccessful fulfillment for user: {logging_obj['user']} " + f"due to {Json.loads(exc.response.text).get('message')} with details: " f"[lms user id: {logging_obj['lms_user_id']}, order id: {logging_obj['order_id']}, " f"course id: {logging_obj['course_id']}, message_id: {logging_obj['message_id']}, " f"celery_task_id: {logging_obj['celery_task_id']}]"