Adding some minor changes to logs (#27127)

This commit is contained in:
Awais Jibran
2021-03-24 17:25:04 +05:00
committed by GitHub
parent e802614634
commit 49296005db
2 changed files with 7 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import os
from django.conf import settings
from django.core.files import File
from edx_django_utils.monitoring import set_custom_attribute, set_custom_attributes_for_course_key
from path import Path as path
from rest_framework import status
from rest_framework.exceptions import AuthenticationFailed
@@ -112,6 +113,8 @@ class CourseImportView(CourseImportExportViewMixin, GenericAPIView):
Kicks off an asynchronous course import and returns an ID to be used to check
the task's status
"""
set_custom_attribute('course_import_init', True)
set_custom_attributes_for_course_key(course_key)
try:
if 'course_data' not in request.FILES:
raise self.api_error(
@@ -150,7 +153,7 @@ class CourseImportView(CourseImportExportViewMixin, GenericAPIView):
'task_id': async_result.task_id
})
except Exception as e:
log.exception(f'Course import {course_key: Unknown error in import}')
log.exception(f'Course import {course_key}: Unknown error in import')
raise self.api_error(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
developer_message=str(e),

View File

@@ -274,7 +274,7 @@ class ImportManager:
Import all static items into the content store.
"""
if self.static_content_store is None:
log.error(
log.warning(
f'Course import {self.target_id}: Static content store is None. Skipping static content import.'
)
return
@@ -356,7 +356,8 @@ class ImportManager:
asset_md.from_xml(asset)
all_assets.append(asset_md)
except OSError:
logging.error(f'Course import {course_id}: No {assets_filename} file present.')
# file does not exist.
logging.info(f'Course import {course_id}: No {assets_filename} file present.')
return
except Exception as exc: # pylint: disable=W0703
monitor_import_failure(course_id, 'Updating', exception=exc)