Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update logging message #301

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion commerce_coordinator/apps/lms/clients.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
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
Expand Down Expand Up @@ -118,8 +120,10 @@ def post(self, url, json, line_item_state_payload, logging_obj, timeout=None):
sender=self.__class__,
**fulfill_line_item_state_payload
)
error_message = Json.loads(exc.response.text).get('message')
Copy link
Member

@aht007 aht007 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message is already being logged here. We don't need to modify the logging below IMO as @attiyaIshaque is currently working on improving logging and will be dealing with this too ideally under the scope of her ticket

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In DD logs the error message is missing and we added it.
In the SONIC-794 mentioned that to formate the DD log with the appropriate information.

logger.info(
f"Unsuccessful fulfillment for user: {logging_obj['user']} with details: "
f"Unsuccessful fulfillment for user: {logging_obj['user']} "
f"due to {error_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']}]"
Expand Down
Loading