nickw444 / flask-ldap3-login

LDAP3 Logins for Flask/Flask-Login
http://flask-ldap3-login.readthedocs.org/en/latest/
MIT License
73 stars 38 forks source link

Logging: flask-ldap3-login adds the console handler to the root level logger #107

Closed nsmcan closed 2 years ago

nsmcan commented 2 years ago

flask-ldap3-login inadvertently adds the console handler to the root level logger by calling an uninitialized handler in forms.py:

logging.debug('Validating LDAPLoginForm against LDAP')
...
logging.debug("Form validation failed before we had a chance to check ldap. Reasons: '{0}'".format(self.errors))

This causes log messages from all other, unrelated, loggers to be duplicated on the console.

Could you please kindly fix code by using the log variable instead, which you already defined in code on the line 8

log.debug('Validating LDAPLoginForm against LDAP')
...
log.debug("Form validation failed before we had a chance to check ldap. Reasons: '{0}'".format(self.errors))
gmacon commented 2 years ago

I'd happily merge a PR with this change if someone wants to write it.

nsmcan commented 2 years ago

I'll prepare it soon

nickw444 commented 2 years ago

Fixed by #108