Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cpython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sip
Cpython
Commits
251104f1
Unverified
Commit
251104f1
authored
2 years ago
by
Miss Islington (bot)
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[3.10] gh-92859: Doc: add info about logging.debug() calling basicConfig() (GH-93063) (GH-93150)
parent
b15b94de
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Doc/howto/logging.rst
+5
-4
5 additions, 4 deletions
Doc/howto/logging.rst
Doc/library/logging.rst
+8
-0
8 additions, 0 deletions
Doc/library/logging.rst
with
13 additions
and
4 deletions
Doc/howto/logging.rst
+
5
−
4
View file @
251104f1
...
...
@@ -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,
...
...
This diff is collapsed.
Click to expand it.
Doc/library/logging.rst
+
8
−
0
View file @
251104f1
...
...
@@ -242,6 +242,10 @@ is the module's name in the Python package namespace.
above example). In such circumstances, it is likely that specialized
:class:`Formatter`\ s would be used with particular :class:`Handler`\ s.
If no handler is attached to this logger (or any of its ancestors,
taking into account the relevant :attr:`Logger.propagate` attributes),
the message will be sent to the handler set on :attr:`lastResort`.
.. versionchanged:: 3.2
The *stack_info* parameter was added.
...
...
@@ -1038,6 +1042,10 @@ functions.
above example). In such circumstances, it is likely that specialized
:class:`Formatter`\ s would be used with particular :class:`Handler`\ s.
This function (as well as :func:`info`, :func:`warning`, :func:`error` and
:func:`critical`) will call :func:`basicConfig` if the root logger doesn't
have any handler attached.
.. versionchanged:: 3.2
The *stack_info* parameter was added.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment