Skip to content

Double logging in eapp.better_logging() #756

@chicham

Description

@chicham

Description

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

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

Reproduction

#!/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions