Connect root logger to null handler by default

In the default logging config, create a NullHandler logging handler
and connect the root logger to that.

Starting in python 3.2[1], a logging handler of last resort will output
exceptions to stderr if no handlers are configured.  Currently, our
default logging configuration has no handlers configured for the
root logger, and therefore libraries which log errors or exceptions
on loggers that do not appear in our configuration will use the logger
of last resort.

This is the case for paramiko.  During our key scanning, we now expect
paramiko to raise some exceptions about some host keys being invalid.
We have an exception handler to avoid logging the exception when it is
raised to us, however, paramiko also logs the exception under its own
namespace before raising it.  In order to suppress the output of these
exceptions, we need to ensure that paramiko logs have a handler.  The
easiest way to do that for paramiko and other libraries is by routing
the root logger to null, which was our original intent.


Change-Id: Iaa57ed0f0452eefd376a68ac21f49f3141cdaa25
James E. Blair 2 years ago
parent bd6dea8f97
commit 12d128c170

'level': 'INFO',
'formatter': 'simple',
'null': {
'class': 'logging.NullHandler',
'loggers': {
'nodepool': {
'level': 'WARN',
'root': {'handlers': []},
'root': {'handlers': ['null']},