Skip to content

Commit bdf3e1e

Browse files
committed
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
1 parent 2c4ec63 commit bdf3e1e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/writing/logging.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ the configuration dictionary.
163163
'formatter': 'f',
164164
'level': logging.DEBUG}
165165
},
166-
loggers = {
167-
'root': {'handlers': ['h'],
168-
'level': logging.DEBUG}
169-
}
166+
root = {
167+
'handlers': ['h'],
168+
'level': logging.DEBUG,
169+
},
170170
)
171171
172172
dictConfig(logging_config)

0 commit comments

Comments
 (0)