From 2fc844e5a5d75fee8b6fe21e17873449deb07e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Fri, 11 Jan 2019 18:03:24 +0100 Subject: [PATCH 1/3] disable_existing_loggers does not apply to the root logger --- Doc/howto/logging.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index 2a2282e9ecf068..3f21f3dbe77414 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -695,15 +695,15 @@ noncoders to easily modify the logging properties. .. warning:: The :func:`fileConfig` function takes a default parameter, ``disable_existing_loggers``, which defaults to ``True`` for reasons of backward compatibility. This may or may not be what you want, since it - will cause any loggers existing before the :func:`fileConfig` call to - be disabled unless they (or an ancestor) are explicitly named in the - configuration. Please refer to the reference documentation for more + will cause any non-root loggers existing before the :func:`fileConfig` + call to be disabled unless they (or an ancestor) are explicitly named in + the configuration. Please refer to the reference documentation for more information, and specify ``False`` for this parameter if you wish. The dictionary passed to :func:`dictConfig` can also specify a Boolean value with key ``disable_existing_loggers``, which if not specified explicitly in the dictionary also defaults to being interpreted as - ``True``. This leads to the logger-disabling behaviour described above, + ``True``. This leads to the logger-disabling behaviour described above, which may not be what you want - in which case, provide the key explicitly with a value of ``False``. @@ -749,7 +749,7 @@ the new dictionary-based approach: simpleExample: level: DEBUG handlers: [console] - propagate: no + propagate: false root: level: DEBUG handlers: [console] @@ -802,7 +802,7 @@ the best default behaviour. If for some reason you *don't* want these messages printed in the absence of any logging configuration, you can attach a do-nothing handler to the top-level logger for your library. This avoids the message being printed, since a handler -will be always be found for the library's events: it just doesn't produce any +will always be found for the library's events: it just doesn't produce any output. If the library user configures logging for application use, presumably that configuration will add some handlers, and if levels are suitably configured then logging calls made in library code will send output to those From b8643b351fec76e79720e499767884019b33e237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Fri, 11 Jan 2019 18:39:14 +0100 Subject: [PATCH 2/3] disable_existing_loggers does not apply to the root logger --- Doc/library/logging.config.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst index 7f6c3c69739d01..683d6ed5e8ba52 100644 --- a/Doc/library/logging.config.rst +++ b/Doc/library/logging.config.rst @@ -107,9 +107,9 @@ in :mod:`logging` itself) and defining handlers which are declared either in enabled. The default is ``True`` because this enables old behaviour in a backward-compatible way. This behaviour is to - disable any existing loggers unless they or - their ancestors are explicitly named in the - logging configuration. + disable any existing non-root loggers unless + they or their ancestors are explicitly named + in the logging configuration. .. versionchanged:: 3.4 An instance of a subclass of :class:`~configparser.RawConfigParser` is @@ -313,8 +313,8 @@ otherwise, the context is used to determine what to instantiate. If the specified value is ``True``, the configuration is processed as described in the section on :ref:`logging-config-dict-incremental`. -* *disable_existing_loggers* - whether any existing loggers are to be - disabled. This setting mirrors the parameter of the same name in +* *disable_existing_loggers* - whether any existing non-root loggers are + to be disabled. This setting mirrors the parameter of the same name in :func:`fileConfig`. If absent, this parameter defaults to ``True``. This value is ignored if *incremental* is ``True``. From dd2f770390b436a7b7c72d4eb0248ea5ee629954 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Wed, 23 Jan 2019 07:04:26 +0000 Subject: [PATCH 3/3] Update logging.rst Removed an unrelated change. --- Doc/howto/logging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index 3f21f3dbe77414..c90df4301fa688 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -749,7 +749,7 @@ the new dictionary-based approach: simpleExample: level: DEBUG handlers: [console] - propagate: false + propagate: no root: level: DEBUG handlers: [console]