mirror of
https://github.com/python/cpython.git
synced 2025-12-03 16:19:41 +00:00
bpo-46557: Log captured warnings without format string (GH-30975)
This commit is contained in:
parent
16995ed0f2
commit
d8066b420b
2 changed files with 4 additions and 1 deletions
|
|
@ -2246,7 +2246,9 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
|
||||||
logger = getLogger("py.warnings")
|
logger = getLogger("py.warnings")
|
||||||
if not logger.handlers:
|
if not logger.handlers:
|
||||||
logger.addHandler(NullHandler())
|
logger.addHandler(NullHandler())
|
||||||
logger.warning("%s", s)
|
# bpo-46557: Log str(s) as msg instead of logger.warning("%s", s)
|
||||||
|
# since some log aggregation tools group logs by the msg arg
|
||||||
|
logger.warning(str(s))
|
||||||
|
|
||||||
def captureWarnings(capture):
|
def captureWarnings(capture):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Warnings captured by the logging module are now logged without a format string to prevent systems that group logs by the msg argument from grouping captured warnings together.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue