[issue36318] Adding support for setting the "disabled" attribute of loggers from logging.config.dictConfig

Géry report at bugs.python.org
Mon Mar 18 04:33:53 EDT 2019


Géry <gery.ogam at gmail.com> added the comment:

Actually people do this all the time, to deactivate the logging of some third-party libraries (me included). For instance:

* https://stackoverflow.com/questions/24344045/how-can-i-completely-remove-any-logging-from-requests-module-in-python
* https://stackoverflow.com/questions/34598952/how-to-disable-info-logging-from-a-third-party-module-in-python
* https://stackoverflow.com/questions/38102291/turn-off-logging-in-schedule-library

And currently we can only use either solution 2 or 3 with `logging.config.dictConfig` (which are more verbose and less explicit). We cannot use solution 1 with `logging.config.dictConfig`.

In addition, all public attributes in the `__init__` methods of the `logging.Formatter`, `logging.Handler` and `logging.Logger` classes can be set from `logging.config.dictConfig`, except the `disabled` attribute, which is inconsistent.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36318>
_______________________________________


More information about the Python-bugs-list mailing list