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

Aberta Para iniciantes
#8,935 3 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@rdxrahul12 já está trabalhando nisso.

Desde 2/12/2026.

  • #8940 de @rdxrahul12 — aberto

Avaliação

Dificuldade
1/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
85/100
Tipo de issue
Documentação
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
documentation

Direção de pesquisa

Leia a seção Child Loggers e a dica sobre caplog em docs/core/logger.md (por volta das linhas 969 e 1153). Atualize-as para explicar o nível do logger raiz quando não existe um Logger pai e como os testes podem definir o nível ou criar um pai. A issue também sugere adicionar uma nota de versão para 3.42.0; confirme onde ficam as notas de versão e documente a mudança de comportamento.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
Python
Estrelas
3.3k
Forks
511
Merge médio
2d 23h
PRs com merge (30d)
50

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de aws-powertools/powertools-lambda-python

Todas as issues de aws-powertools/powertools-lambda-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.