Fix logging

code stolen from django-auth-ldap