Created
July 8, 2011 22:19
-
-
Save SEJeff/1072963 to your computer and use it in GitHub Desktop.
How to enable debug logging for django_auth_ldap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################## django-auth-ldap ############################## | |
if DEBUG: | |
import logging, logging.handlers | |
logfile = "/tmp/django-ldap-debug.log" | |
my_logger = logging.getLogger('django_auth_ldap') | |
my_logger.setLevel(logging.DEBUG) | |
handler = logging.handlers.RotatingFileHandler( | |
logfile, maxBytes=1024 * 500, backupCount=5) | |
my_logger.addHandler(handler) | |
############################ end django-auth-ldap ############################ |
Adding this to settings.py can also print errors to console:
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {"console": {"class": "logging.StreamHandler"}},
"loggers": {"django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]}},
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great stuff, it stopped the pain for me.