-
Notifications
You must be signed in to change notification settings - Fork 104
Description
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.