From 142e604064d2629aed2a6c30e1ccff54dc6c7dda Mon Sep 17 00:00:00 2001 From: Thumose3 <45205349+Thutmose3@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:03:40 +0100 Subject: [PATCH] Chore: improve logging for debugging purposes (#1991) * Chore: improve logging for debugging purposes When tryin to fix tests or see why the import does not work, i usually get a cryptic error message not pointing to the part of the code that failed. It just gives the exception but not where it comes from. By adding exc_info=True, the traceback is visible and its much easier to debug. Also i think warning level should be used instead of debug for these import errors * Update resources.py --- import_export/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import_export/resources.py b/import_export/resources.py index 74a585c91..2295881a8 100644 --- a/import_export/resources.py +++ b/import_export/resources.py @@ -780,7 +780,7 @@ def import_row(self, row, instance_loader, **kwargs): # There is no point logging a transaction error for each row # when only the original error is likely to be relevant if not isinstance(e, TransactionManagementError): - logger.debug(e, exc_info=e) + logger.debug(e, exc_info=True) row_result.errors.append( self.get_error_result_class()(e, row=row, number=kwargs["row_number"]) )