Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1cbf78a

Browse files
committed
merge heads
2 parents d05853d + 8bf2aea commit 1cbf78a

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

Doc/howto/logging.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,22 @@ You can see that the config file approach has a few advantages over the Python
651651
code approach, mainly separation of configuration and code and the ability of
652652
noncoders to easily modify the logging properties.
653653

654+
.. warning:: The :func:`fileConfig` function takes a default parameter,
655+
``disable_existing_loggers``, which defaults to ``True`` for reasons of
656+
backward compatibility. This may or may not be what you want, since it
657+
will cause any loggers existing before the :func:`fileConfig` call to
658+
be disabled unless they (or an ancestor) are explicitly named in the
659+
configuration. Please refer to the reference documentation for more
660+
information, and specify ``False`` for this parameter if you wish.
661+
662+
The dictionary passed to :func:`dictConfig` can also specify a Boolean
663+
value with key ``disable_existing_loggers``, which if not specified
664+
explicitly in the dictionary also defaults to being interpreted as
665+
``True``. This leads to the logger-disabling behaviour described above,
666+
which may not be what you want - in which case, provide the key
667+
explicitly with a value of ``False``.
668+
669+
654670
.. currentmodule:: logging
655671

656672
Note that the class names referenced in config files need to be either relative

Doc/library/logging.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,22 @@ listed below.
4949
Logger Objects
5050
--------------
5151

52-
Loggers have the following attributes and methods. Note that Loggers are never
52+
Loggers have the following attributes and methods. Note that Loggers are never
5353
instantiated directly, but always through the module-level function
54-
``logging.getLogger(name)``.
54+
``logging.getLogger(name)``. Multiple calls to :func:`getLogger` with the same
55+
name will always return a reference to the same Logger object.
56+
57+
The ``name`` is potentially a period-separated hierarchical value, like
58+
``foo.bar.baz`` (though it could also be just plain ``foo``, for example).
59+
Loggers that are further down in the hierarchical list are children of loggers
60+
higher up in the list. For example, given a logger with a name of ``foo``,
61+
loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all
62+
descendants of ``foo``. The logger name hierarchy is analogous to the Python
63+
package hierarchy, and identical to it if you organise your loggers on a
64+
per-module basis using the recommended construction
65+
``logging.getLogger(__name__)``. That's because in a module, ``__name__``
66+
is the module's name in the Python package namespace.
67+
5568

5669
.. class:: Logger
5770

0 commit comments

Comments
 (0)