diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 431ff41b352048..900c2e7e1d7f37 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1728,10 +1728,11 @@ def callHandlers(self, record): c = self found = 0 while c: - for hdlr in c.handlers: - found = found + 1 - if record.levelno >= hdlr.level: - hdlr.handle(record) + if record.levelno >= c.level: + for hdlr in c.handlers: + found = found + 1 + if record.levelno >= hdlr.level: + hdlr.handle(record) if not c.propagate: c = None #break out else: diff --git a/Misc/NEWS.d/next/Library/2025-10-10-02-40-29.gh-issue-139878.0hVfBS.rst b/Misc/NEWS.d/next/Library/2025-10-10-02-40-29.gh-issue-139878.0hVfBS.rst new file mode 100644 index 00000000000000..6cf9181c99372f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-10-10-02-40-29.gh-issue-139878.0hVfBS.rst @@ -0,0 +1 @@ +In addition to checking the handler level, also verify the logger level when propagating log message.