Skip to content

Add exception info to logger message when exceptions are ignored #611

@tmarice

Description

@tmarice

We're using django-redis as a session cache backend for our Django project, with DJANGO_REDIS_IGNORE_EXCEPTIONS and DJANGO_REDIS_LOG_IGNORED_EXCEPTIONS set to True.

Unfortunately, we're experiencing a pesky Redis TimeoutError, which due to the previous settings, is only getting logged as:

ERROR    django_redis.cache 2022-06-08 17:16:54,470 cache.py _decorator 35 Redis TimeoutError: Timeout reading from socket

The issue happens only in the production environment, and we can't get a full exception traceback without impacting customers, so debugging this has been difficult. We'll probably work around this by live-editing the cache module on the web servers.

What are your thoughts on using self.logger.exception instead of self.logger.error in the omit_exception decorator, or adding another setting (e.g. DJANGO_REDIS_LOG_EXCEPTION_TRACEBACK) which would control the logging behavior?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions