Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make logging.InitializeDefaultLogger private #29495

Merged

Conversation

learnitall
Copy link
Contributor

@learnitall learnitall commented Nov 29, 2023

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Are you a user of Cilium? Please add yourself to the Users doc
  • Thanks for contributing!

This PR renames the function logging.InitializeDefaultLogger to logging.initializeDefaultLogger in order to make it private to the logging module. This function should only be used to initialize the logging.DefaultLogger variable, and should not be used by users as a parent logger. This is because the logger returned by logging.InitializeDefaultLogger will always use the hard-coded default logging settings, while logging.DefaultLogger is adjusted based on the user configuration.

The changes in pkg/endpoint/log.go remove the use of logging.InitializeDefaultLogger while also fixing #29215.

Fixes: #29215

Fix bug preventing endpoint-related debug logs from being emitted

@learnitall learnitall added area/daemon Impacts operation of the Cilium daemon. release-note/misc This PR makes changes that have no direct user impact. labels Nov 29, 2023
@learnitall learnitall requested review from a team as code owners November 29, 2023 22:04
@learnitall learnitall force-pushed the pr/learnitall/make-initialize-private branch from 86cbd02 to 4e820dc Compare November 29, 2023 22:06
@tklauser
Copy link
Member

/test

@learnitall learnitall changed the title Pr/learnitall/make initialize private Make logging.InitializeDefaultLogger private Nov 30, 2023
@tklauser
Copy link
Member

Make `logging.InitializeDefaultLogger` private

The release notes are user-facing and thus ideally should document the impact a user will see because of this change. How about saying what issue this PR fixes?

Copy link
Member

@tklauser tklauser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failures in Test/EndpointSuite/TestEndpointLogFormat look related.

@learnitall learnitall force-pushed the pr/learnitall/make-initialize-private branch from 4e820dc to bdab87c Compare November 30, 2023 19:38
@learnitall
Copy link
Contributor Author

Make `logging.InitializeDefaultLogger` private

The release notes are user-facing and thus ideally should document the impact a user will see because of this change. How about saying what issue this PR fixes?

Ah good point, I'll update it.

@learnitall learnitall force-pushed the pr/learnitall/make-initialize-private branch from bdab87c to 350c424 Compare November 30, 2023 20:02
@tklauser
Copy link
Member

/test

The function InitializeDefaultLogger creates a new logger with the
default settings and returns it. This commit removes a call to this
function that doesn't save the return value, essentially calling it for
no reason.

Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
The DefaultLogger variable in the logging module serves as a parent logger
which all other loggers can be derived from. It is initialized using the
InitializeDefaultLogger function and then adjusted on startup based on
user configuration. Users should not call InitializeDefaultLogger to
create a parent logger for their logger, since the logger returned by
InitializeDefaultLogger will always use the hardcoded defaults. For
example, the logger returned will always be of level INFO, even if a user
has enabled debug logging. To make this clear, this commit renames
InitializeDefaultLogger to initializeDefaultLogger to signal that it should
not be used outside of the logging module.

Fixes: cilium#29215

Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
@tklauser tklauser force-pushed the pr/learnitall/make-initialize-private branch from 350c424 to 7cdd9e6 Compare December 1, 2023 10:22
@tklauser
Copy link
Member

tklauser commented Dec 1, 2023

Rebased to pull in #29455 fixing ci-runtime

@tklauser
Copy link
Member

tklauser commented Dec 1, 2023

/test

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Dec 1, 2023
@tklauser tklauser added this pull request to the merge queue Dec 1, 2023
Merged via the queue into cilium:main with commit 00ab252 Dec 1, 2023
61 checks passed
@tklauser tklauser added needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Dec 5, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.13.10 Dec 5, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.14.5 Dec 5, 2023
@tklauser
Copy link
Member

tklauser commented Dec 5, 2023

According to #29544 (comment) it seems that #29215 also occurs on v1.13 (and presumably also v1.14). I've added the corresponding labels but I assume that they might need manual backports.

@learnitall
Copy link
Contributor Author

Sounds good @tklauser, I'll keep a look out.

@nbusseneau nbusseneau added the backport/author The backport will be carried out by the author of the PR. label Dec 5, 2023
@nbusseneau
Copy link
Member

@learnitall Indeed this will need manual backports, as the changes depend on changes made in #26327 and #23971 which were not backported. I will skip this PR in the current round of backports and added the backport/author label.

@antonipp
Copy link
Contributor

antonipp commented Dec 7, 2023

Hi, FYI I opened a backport PR for 1.13 since this bug affects us in that version: #29700

@tklauser tklauser added backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. and removed needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels Dec 8, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.13 in 1.13.10 Dec 8, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.13 in 1.13.10 Dec 8, 2023
@github-actions github-actions bot added backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. and removed backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels Dec 8, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed this from Backport pending to v1.13 in 1.13.10 Dec 8, 2023
@nebril nebril added this to Needs backport from main in 1.14.6 Dec 11, 2023
@nebril nebril removed this from Needs backport from main in 1.14.5 Dec 11, 2023
@tklauser tklauser added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Dec 13, 2023
@github-actions github-actions bot added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Dec 15, 2023
@gentoo-root gentoo-root moved this from Needs backport from main to Backport done to v1.14 in 1.14.6 Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon. backport/author The backport will be carried out by the author of the PR. backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.14.6
Backport done to v1.14
Development

Successfully merging this pull request may close these issues.

Messages generated inside controllers are not logged
4 participants