diff options
| author | Krishnaprasad MG <krishna@holvi.com> | 2025-12-15 15:39:06 +0100 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-12-19 12:58:29 -0500 |
| commit | 7a2f35b1b755b20a1e4d290a88bf059e6897f798 (patch) | |
| tree | fba0bbd7a6f6475645b8262f443652da5b5d1c58 /django | |
| parent | 60fecd1d445224fa00385f5f1fde75999da7bec8 (diff) | |
Fixed #36487 -- Fixed logger error message with partial callbacks.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/base.py | 15 | ||||
| -rw-r--r-- | django/test/testcases.py | 8 |
2 files changed, 10 insertions, 13 deletions
diff --git a/django/db/backends/base/base.py b/django/db/backends/base/base.py index 3f3d29874a..23015a57a3 100644 --- a/django/db/backends/base/base.py +++ b/django/db/backends/base/base.py @@ -741,11 +741,8 @@ class BaseDatabaseWrapper: try: func() except Exception as e: - logger.error( - f"Error calling {func.__qualname__} in on_commit() (%s).", - e, - exc_info=True, - ) + name = getattr(func, "__qualname__", func) + logger.exception("Error calling %s in on_commit() (%s).", name, e) else: func() @@ -759,11 +756,11 @@ class BaseDatabaseWrapper: try: func() except Exception as e: - logger.error( - f"Error calling {func.__qualname__} in on_commit() during " - f"transaction (%s).", + name = getattr(func, "__qualname__", func) + logger.exception( + "Error calling %s in on_commit() during transaction (%s).", + name, e, - exc_info=True, ) else: func() diff --git a/django/test/testcases.py b/django/test/testcases.py index c587f770a6..c56fa52806 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -1523,11 +1523,11 @@ class TestCase(TransactionTestCase): try: callback() except Exception as e: - logger.error( - f"Error calling {callback.__qualname__} in " - f"on_commit() (%s).", + name = getattr(callback, "__qualname__", callback) + logger.exception( + "Error calling %s in on_commit() (%s).", + name, e, - exc_info=True, ) else: callback() |
