Bug: child Logger without a level ignores its parent's log level since 3.6.0
I maintainer di solito rispondono entro 1 giorno
@saimcyber ci sta già lavorando.
Dal 12/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
L’issue indica la gestione del livello dei Logger figli e refresh_sample_rate_calculation() come comportamento interessato, ma non fornisce alcun percorso di file o di test. Inizia seguendo la costruzione dei Logger e l’aggiornamento della frequenza di campionamento nel pacchetto Python, poi trova i test correlati ai logger. Il lavoro è completato quando un figlio senza un livello esplicito segue il livello configurato e campionato del genitore, mentre un figlio con un proprio livello lo mantiene; aggiungi test per i casi segnalati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behaviour
A child Logger (Logger(child=True)) created without a level should follow its parent's log level: a level set in the parent's constructor, later setLevel() calls, and debug sampling. That's how it worked up to 3.5.0, and it's what the docs describe: "All state changes will be propagated bi-directionally between Child and Parent."
Current Behaviour
Since 3.6.0 (#5950), a child without a level always ends up at INFO (or at POWERTOOLS_LOG_LEVEL when that's set) and stops following its parent:
- parent
level="DEBUG",setLevel("DEBUG")orsampling_rate=1: the child's DEBUG logs are dropped - parent
level="WARNING": the child still emits INFO - a child that decorates the handler with
POWERTOOLS_LOGGER_SAMPLE_RATEset: every warm invocation resets it to INFO child.log_levelalways reports 20
#5950 was meant to let a child use its own level when one is passed. It also changed children that don't pass one.
Code snippet
# shared.py
from aws_lambda_powertools import Logger
logger = Logger(child=True) # service comes from POWERTOOLS_SERVICE_NAME=payment
def work():
logger.debug("child debug")
logger.info("child info")
# app.py
import shared
from aws_lambda_powertools import Logger
logger = Logger(level="DEBUG") # same with logger.setLevel("DEBUG") or Logger(sampling_rate=1)
shared.work()
# 3.5.0: prints "child debug" and "child info"
# 3.6.0+: prints only "child info" <- the child's DEBUG log is lost
Possible Solution
Only call setLevel on a child when a level is passed, so it stays NOTSET and inherits like before. The same goes for the level refresh_sample_rate_calculation() restores for a child. log_level should then return the effective level, so a child reports the level it actually logs at. I have a fix with tests ready and can open a PR once this is triaged.
Steps to Reproduce
- Put the two files above in a folder and set
POWERTOOLS_SERVICE_NAME=payment. pip install aws-lambda-powertools==3.38.0, then runpython app.py: only "child info" is printed.pip install aws-lambda-powertools==3.5.0and run it again: both lines are printed.
Did you run the reproduction yourself?
Yes, I ran it and saw the failure
Powertools for AWS Lambda (Python) version
3.38.0 (broken since 3.6.0)
AWS Lambda function runtime
3.12
Packaging format used
PyPi
Debugging logs
Child Logger without a level, same two-module app on each version:
parent 3.5.0 3.6.0 - 3.38.0
level="DEBUG" / setLevel("DEBUG") / sampling DEBUG+INFO INFO only
sampling decorator, 2 warm invocations both INFO only
level="WARNING" nothing child INFO leaks
child.log_level (parent DEBUG) 0 20
- Lingua principale
- Python
- Stelle
- 3.3k
- Fork
- 511
- Merge medio
- 3g 8h
- PR unite (30g)
- 103
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws-powertools/powertools-lambda-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws-powertools/powertools-lambda-python#8801 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
aws-powertools/powertools-lambda-python#8800 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: POWERTOOLS_IDEMPOTENCY_DISABLED set to an empty or non-boolean value crashes every invocationForse già presa @lechakrawarthy l’ha presa 11 giorni fa. Apertabug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
aws-powertools/powertools-lambda-python#8728 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: Redis layer fails the invocation instead of retrying when a record expires between SET NX and GETForse già presa @coughlmao l’ha presa 11 giorni fa. Apertabug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
aws-powertools/powertools-lambda-python#8727 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: Redis orphan lock timeout ignores expires_after_seconds and is always 10 secondsForse già presa @CJstate l’ha presa 11 giorni fa. Apertabug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
aws-powertools/powertools-lambda-python#8726 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di aws-powertools/powertools-lambda-python
Issue simili
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Huerte/algo-solutions-python#254 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
MichaelYcJo/SpecSeal#1543 ·
-
size/s
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
sipyourdrink-ltd/bernstein#7179 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted python up-for-grabs
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
andrewsiah/agentswarm-data-tasks#309 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno