gh-92859: Doc: add info about logging.debug() calling basicConfig() (GH-93063) (GH-93151)

(cherry picked from commit 2176898308)
This commit is contained in:
Miss Islington (bot) 2022-05-23 12:45:03 -07:00 committed by GitHub
parent f0950585a3
commit cea65730a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -178,10 +178,11 @@ following example::
raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level, ...)
The call to :func:`basicConfig` should come *before* any calls to :func:`debug`,
:func:`info` etc. As it's intended as a one-off simple configuration facility,
only the first call will actually do anything: subsequent calls are effectively
no-ops.
The call to :func:`basicConfig` should come *before* any calls to
:func:`debug`, :func:`info`, etc. Otherwise, those functions will call
:func:`basicConfig` for you with the default options. As it's intended as a
one-off simple configuration facility, only the first call will actually do
anything: subsequent calls are effectively no-ops.
If you run the above script several times, the messages from successive runs
are appended to the file *example.log*. If you want each run to start afresh,