Skip to content

Root Logger being using the Leaderelection module #2364

Open
@jordantshaw

Description

@jordantshaw

What happened (please include outputs or screenshots):
It appears that the leaderelectoin module is logging directly to the root logger logging.info(...)
This is problematic when trying to change the log level of the kubernetes logs.

You can see here "root" is being displayed as the logger name. So I am not able to specifically change the log level of the kubernetes logs without changing the loglevel for all log messages.

[2025-02-27 13:27:59,818] [INFO] [root] yet to finish lease_duration, lease held by dc6e7813-2f8a-4428-a21c-00670c6543da and has not expired

What you expected to happen:
I would expect to be able to configure the loglevel using something like below, however it has no affect.
logging.getLogger('kubernetes').setLevel(logging.ERROR)

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): client v1.30.5, server v1.32.0
  • OS (e.g., MacOS 10.13.6): MacOS 15.3.1
  • Python version (python --version) 3.12.6
  • Python client version (pip list | grep kubernetes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions