Skip to content

some logs are not json format #2535

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

Merged

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 :(

@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

@MortalHappiness
Copy link
Member

MortalHappiness commented Nov 13, 2024

Update: I found that it's hard to add the logger information. Since all of our loggers already include logger information, it's fine if the logs from the library don't contain it. We can still easily debug our own app. Let's not bother implementing this.

@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.

Copy link
Member

@MortalHappiness MortalHappiness left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -153,8 +154,11 @@ func main() {
combineLoggerR := zapr.NewLogger(combineLogger)

ctrl.SetLogger(combineLoggerR)
klog.SetLogger(combineLoggerR)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add comments to explain why we need to set up klog?

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.

Nice!

@kevin85421 kevin85421 merged commit 8cc1acf into ray-project:master Nov 20, 2024
25 checks passed
@fscnick fscnick deleted the chore/some-logs-are-not-json-format branch November 22, 2024 12:50
Ygnas pushed a commit to Ygnas/kuberay that referenced this pull request Mar 20, 2025
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