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

some logs are not json format #2535

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fscnick
Copy link
Contributor

@fscnick fscnick commented Nov 12, 2024

Why are these changes needed?

Some logs from client-go are not in JSON format.

According to kubernetes/client-go#18 (comment),
Calling klog.SetLogger() applies logs with JSON format from client-go.

Related issue number

Closes #2512

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Signed-off-by: fscnick <fscnick.dev@gmail.com>
Signed-off-by: fscnick <fscnick.dev@gmail.com>
@fscnick
Copy link
Contributor Author

fscnick commented Nov 12, 2024

@kevin85421 PTAL

@fscnick fscnick changed the title Chore/some logs are not json format some logs are not json format Nov 12, 2024
Copy link
Member

@kevin85421 kevin85421 left a comment

Choose a reason for hiding this comment

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

Could you add a screenshot? CC @MortalHappiness: Could you shepherd this PR? I’m currently at KubeCon.

@fscnick
Copy link
Contributor Author

fscnick commented Nov 13, 2024

Could you add a screenshot? CC @MortalHappiness: Could you shepherd this PR? I’m currently at KubeCon.

Thanks for the feedback. Here it is.
kuberay client-go log

k8sLogger := k8szap.New(k8szap.UseFlagOptions(&opts))
ctrl.SetLogger(k8sLogger)
klog.SetLogger(k8sLogger)

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line

@MortalHappiness
Copy link
Member

MortalHappiness commented Nov 13, 2024

@fscnick From your screenshot, it seems that the logger information is lost. Can you try to also log the logger?

I mean before the log is set to json format, we know that this log is from leaderelection.go right? But from your screenshot, we don't know which logger issues this log message.

If it's technically infeasible, feel free to leave another comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Some client-go logs are not in JSON format
3 participants