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)

Activity

yliaog

yliaog commented on Mar 12, 2025

@yliaog
Contributor

/help

k8s-ci-robot

k8s-ci-robot commented on Mar 12, 2025

@k8s-ci-robot
Contributor

@yliaog:
This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

added
help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
on Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Root Logger being using the Leaderelection module · Issue #2364 · kubernetes-client/python