summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorMichael P. Nitowski <mpnitowski@gmail.com>2022-03-15 09:01:03 (GMT)
committerGitHub <noreply@github.com>2022-03-15 09:01:03 (GMT)
commitd8066b420b888591f485d132e62979d07abfc3f4 (patch)
tree169b3701864610187960e66cf42a31898bc0b655 /Lib/logging
parent16995ed0f2b697ca1ff966741288e787e1701ca9 (diff)
downloadcpython-d8066b420b888591f485d132e62979d07abfc3f4.zip
cpython-d8066b420b888591f485d132e62979d07abfc3f4.tar.gz
cpython-d8066b420b888591f485d132e62979d07abfc3f4.tar.bz2
bpo-46557: Log captured warnings without format string (GH-30975)
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index e49e0d0..160b1af 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -2246,7 +2246,9 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
logger = getLogger("py.warnings")
if not logger.handlers:
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):
"""