Docs: child Logger without a parent uses the root log level since #8842

Aperta Adatta ai principianti
#8,935 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@rdxrahul12 ci sta già lavorando.

Dal 2/12/2026.

  • #8940 di @rdxrahul12 — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
documentation

Direzione di ricerca

Leggi la sezione Child Loggers e il suggerimento su caplog in docs/core/logger.md (intorno alle righe 969 e 1153). Aggiornali per spiegare il livello del logger root quando non esiste un Logger padre e come i test possono impostare il livello o creare un padre. L’issue suggerisce anche di aggiungere una nota di rilascio per la versione 3.42.0; conferma dove si trovano le note di rilascio e documenta il cambiamento di comportamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

documentation triage
What were you searching in the docs?

How a child Logger behaves in tests when no parent Logger exists, after #8842 (merged, not released yet). I first raised it on the PR: https://github.com/aws-powertools/powertools-lambda-python/pull/8842#issuecomment-7171335297

Is this related to an existing documentation section?

https://docs.aws.amazon.com/powertools/python/latest/core/logger/#child-loggers

How can we improve?

Since #8842, a child Logger without a level stays NOTSET. With no parent Logger in the process, it inherits the root logger's level (WARNING), so logger.info() is dropped. That matches 3.5.0, but on 3.6.0 to 3.41.0 it logged INFO. This test passes on 3.41.0 and fails on develop:

# shared.py
from aws_lambda_powertools import Logger

logger = Logger(service="payment", child=True)


def charge():
    logger.info("charged")


# test_shared.py
import shared


def test_charge_logs(caplog):
    shared.charge()
    assert "charged" in caplog.text

The docs don't cover this case: not the Child Loggers section (docs/core/logger.md line 969), and not the caplog tip under Testing your code (line 1153).

Got a suggestion in mind?
  • docs/core/logger.md line 969, add: "If no parent Logger with the same service exists, the child uses the root logger's level (WARNING by default)."
  • Line 1153, add to the caplog tip: "If the module under test only defines a child Logger, call caplog.set_level(logging.INFO) or create the parent Logger in conftest.py."
  • A line in the 3.42.0 release notes, since users on 3.6.0 or later have only seen INFO.

I can open a PR for the two docs lines. An AI assistant helped me write the test scripts; I ran them on 3.41.0 and develop and checked the output myself.

Acknowledgment
  • I understand the final update might be different from my proposed suggestion, or refused.
Lingua principale
Python
Stelle
3.3k
Fork
511
Merge medio
2g 23h
PR unite (30g)
50

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws-powertools/powertools-lambda-python

Tutte le issue di aws-powertools/powertools-lambda-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.