From bdf3e1ea92dfac8c2b5266f5926ed632e70bfc86 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 10 May 2016 17:05:23 -0600 Subject: [PATCH] Fix incorrect dictConfig example dictConfig expects a special `root` key outside of the `loggers` subdictionary in order to configure the root logger. I've tried the existing example code on python 2.7.5 and 3.5.1, and in neither case does the final log line produce any output (because the root logger remains set to `looging.WARN` by default). Changing the example to use the `root` key causes the log message to appear properly. The `root` key is explained in PEP391: https://www.python.org/dev/peps/pep-0391/#dictionary-schema-detail --- docs/writing/logging.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/writing/logging.rst b/docs/writing/logging.rst index 8763e8dba..9b41abadf 100644 --- a/docs/writing/logging.rst +++ b/docs/writing/logging.rst @@ -163,10 +163,10 @@ the configuration dictionary. 'formatter': 'f', 'level': logging.DEBUG} }, - loggers = { - 'root': {'handlers': ['h'], - 'level': logging.DEBUG} - } + root = { + 'handlers': ['h'], + 'level': logging.DEBUG, + }, ) dictConfig(logging_config)