Skip to content

Commit

Permalink
Use NullHandler instead of basicConfig
Browse files Browse the repository at this point in the history
logging.basicConfig() was propably added to avoid the dreaded "no log handler
found for ..." messages however this is the wrong approach because it interferes
with the log handling in applications using the library, instead libraries
should never set up log handlers and leave it to client application. To avoid
the message, libraries can register the NullHandler though, see for example:

  http://docs.python-guide.org/en/latest/writing/logging/#logging-in-a-library
  • Loading branch information
Matthias Vogelgesang committed Sep 8, 2017
1 parent 809a649 commit 882e279
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dxchange/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
unicode_literals)

import logging
logging.basicConfig()
logging.getLogger(__name__).addHandler(logging.NullHandler())

from dxchange.exchange import *
from dxchange.reader import *
Expand Down

0 comments on commit 882e279

Please sign in to comment.