Skip to content

Commit 48c9acf

Browse files
committed
process: Print better errors to logs, including stacktrace
1 parent c2dbaf5 commit 48c9acf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libcoveweb2/process/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import importlib
22
import logging
3+
import sys
4+
import traceback
35
from datetime import datetime
46

57
from django.conf import settings
@@ -51,7 +53,10 @@ def process_data_worker(id: str):
5153
# To our database
5254
supplied_data.error = str(e)
5355
# To logs
54-
logger.error(e, exc_info=True)
56+
exc_type, exc_value, exc_traceback = sys.exc_info()
57+
logger.error(
58+
"".join(traceback.format_exception(exc_type, exc_value, exc_traceback))
59+
)
5560
# To Sentry
5661
capture_exception(e)
5762

0 commit comments

Comments
 (0)