Skip to content
Snippets Groups Projects
Commit 49c4cc3a authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-139: repair 3rd party logging errors

parent 559e3136
Branches
Tags
1 merge request!96Resolve TMSS-139
...@@ -2,14 +2,17 @@ import os ...@@ -2,14 +2,17 @@ import os
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logging_already_configured = len(logging.root.handlers)>0
from ldap_test import LdapServer from ldap_test import LdapServer
# the 3rd party ldap_test module erroneously does a logging.basicConfig upon module import... if not logging_already_configured:
# logging.basicConfig should only happen in 'main'-like functions. # the 3rd party ldap_test module erroneously does a logging.basicConfig upon module import...
# so, undo the basicConfig by removing the root handlers. # logging.basicConfig should only happen in 'main'-like functions.
# See: https://docs.python.org/3/library/logging.html#logging.basicConfig # so, undo the basicConfig by removing the root handlers.
for h in logging.root.handlers: # See: https://docs.python.org/3/library/logging.html#logging.basicConfig
logging.root.removeHandler(h) for h in logging.root.handlers:
logging.root.removeHandler(h)
from optparse import OptionParser from optparse import OptionParser
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment