Skip to content

Instantly share code, notes, and snippets.

@SEJeff
Created July 8, 2011 22:19
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SEJeff/1072963 to your computer and use it in GitHub Desktop.
Save SEJeff/1072963 to your computer and use it in GitHub Desktop.
How to enable debug logging for django_auth_ldap
############################## 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 ############################
@capncodewash
Copy link

Tremendously useful! Thanks!

@elferink
Copy link

Exactly what I needed, thank you!

@mjdavies
Copy link

Great stuff, it stopped the pain for me.

@brianssendagire
Copy link

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