diff options
author | Yuxin Wu <ppwwyyxxc@gmail.com> | 2022-02-26 18:29:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-26 18:29:51 (GMT) |
commit | fc44b8136ffc501264731ccc7456729b5cf4e74b (patch) | |
tree | 8e948843d15c51315aed6112d484c50ef1b4663d /Doc/howto | |
parent | 0d9b565e62a5fc8c3e9b8c64cce764fe084ccb2b (diff) | |
download | cpython-fc44b8136ffc501264731ccc7456729b5cf4e74b.zip cpython-fc44b8136ffc501264731ccc7456729b5cf4e74b.tar.gz cpython-fc44b8136ffc501264731ccc7456729b5cf4e74b.tar.bz2 |
[doc] Add a note in howto/logging.rst about "do not log to root logger in libraries" (GH-31271)
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/logging.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index fcc6bec..4d76c27 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -831,6 +831,13 @@ should have the desired effect. If an organisation produces a number of libraries, then the logger name specified can be 'orgname.foo' rather than just 'foo'. +.. note:: It is strongly advised that you *do not log to the root logger* + in your library. Instead, use a logger with a unique and easily + identifiable name, such as the ``__name__`` for your library's top-level package + or module. Logging to the root logger will make it difficult or impossible for + the application developer to configure the logging verbosity or handlers of + your library as they wish. + .. note:: It is strongly advised that you *do not add any handlers other than* :class:`~logging.NullHandler` *to your library's loggers*. This is because the configuration of handlers is the prerogative of the application |