google / google/etils

Double logging in eapp.better_logging()

Open
#756 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
259
Forks
34
Avg merge
57m
Merged PRs (30d)
1

Description

## Description

The `eapp.better_logging()` function causes double logging - each log message appears twice.

Commit eacd5c99 added `py_logging.getLogger().addHandler(python_handler)` which creates a duplicate logging path since `ABSLHandler` already delegates to `python_handler` internally.

## Reproduction

```python
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "etils[eapp]",
# "absl-py",
# ]
# ///
"""Minimal working example showing double logging bug."""

import logging

from absl import app
from etils import eapp

def main(_):
logging.info("Hello world")

if __name__ == "__main__":
eapp.better_logging()
app.run(main)
```

Run with: `uv run test_double_logging.py`

Output shows double logging:
```
I 15:55:04 [test_double_logging.py:18]: Hello world
I 15:55:04 [test_double_logging.py:18]: Hello world
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.