From 9438116129a68bc2448576fd3ee265d60507ae79 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike <111072251+ThomasFarstrike@users.noreply.github.com> Date: Mon, 26 Jan 2026 14:39:09 +0100 Subject: [PATCH] fix(logging): allow child loggers to set independent log levels The handler's level was being set to the root logger's level in basicConfig(), which prevented child loggers from setting their own levels. This violated the standard logging architecture where handlers should not filter by level - that's the logger's responsibility. Changed handler.setLevel(level) to handler.setLevel(NOTSET) in basicConfig() so that handlers pass through all messages and let loggers control filtering. This allows code like: logger = logging.getLogger("myapp") logger.setLevel(logging.INFO) logger.info("message") # Now works correctly Previously, INFO messages would be filtered out if the root logger was at WARNING. Fixes: Child loggers unable to log at levels lower than root logger's level Signed-off-by: Thomas Farstrike <111072251+ThomasFarstrike@users.noreply.github.com> --- python-stdlib/logging/logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-stdlib/logging/logging.py b/python-stdlib/logging/logging.py index 551bf7152..2eaa1791e 100644 --- a/python-stdlib/logging/logging.py +++ b/python-stdlib/logging/logging.py @@ -242,7 +242,7 @@ def basicConfig( else: handler = FileHandler(filename, filemode, encoding) - handler.setLevel(level) + handler.setLevel(NOTSET) handler.setFormatter(Formatter(format, datefmt)) logger.setLevel(level)