Skip to content

Commit

Permalink
Chore: improve logging for debugging purposes (#1991)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Thutmose3 authored Nov 3, 2024
1 parent 0e35fd6 commit 142e604
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion import_export/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
)
Expand Down

0 comments on commit 142e604

Please sign in to comment.