Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Please show full traceback in logs #397

@hmpf

Description

@hmpf

I am testing django-auth-ldap and was struggling to set it up. There's something on our end that swallows some exceptions, so we always log our own with full traceback. The exceptions from django-auth-ldap aren't logged with tracebacks.

The log had lots of these:

2025-05-08 11:40:40,220 django_auth_ldap WARNING    Caught LDAPError while authenticating: LDAPError(0, 'Error')

There's no traceback.

I eventually found the problem by entering the virtualenv in use and changing every single instance of "logger.warning" to "logger.exception" in django_auth_ldap.backend. It wasn't a problem with django-auth-ldap, python-ldap or the ldap-server at all... Ldap-logins are working now.

It is not very good developer UX to hide error messages from devs and ops like this. Would it be possible to use logger.exception instead of logger.warning at least if django setting DEBUG is True? That won't make them available to ops (we export error-logs for later analysis) but at least the devs won't struggle as much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions