aimclub / aimclub/GOLEM

[Bug] For some reason your module creates a handler(-s) for root logger

Abierto
#283 0 comentarios 0 reacciones 1 asignado Reclamado por @VadimsAhmers Ver en GitHub
bug invalid
Lenguaje dominante
Python
Estrellas
73
Forks
11
Merge medio
8 h 51 min
PR fusionados (30 d)
4

Descripción

Recently during work on another project I found that w/o implicit init of my logger it usually has strange handler in parent logger (root logger).

```
logger = get_logger("estimators", level=logging.DEBUG) # w/o clearing attributes with init
logger2 = Logger("estimators", level=logging.DEBUG) # w/ clearing

print(logger.handlers)
print(logger.parent)
print(logger.parent.handlers)
print("__")
print(logger2.handlers)
print(logger2.parent)

logger.info("test message")
print("separator")
logger2.info("test message")
```

Out:
```
[]

[ (INFO)>, ]
__
[]
None
[03/11/25 13:07:31] INFO test message base_estimator.py:24
2025-03-11 13:07:31,646 - test message
separator
[03/11/25 13:07:31] INFO test message base_estimator.py:26
```

This bug eventually leads to log duplication.

PS: For first time, there were 3 handlers, one from BAMT, but we do fix it by disabling formatter for root logger.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.