-
Notifications
You must be signed in to change notification settings - Fork 64
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
Log messages being printed to stderr #1902
Comments
@duffney do you think you could provide some insights here? |
Discussed in the community meeting, @duffney will post more context in the issue. @leebenson wonder if you will help fix this bug? |
I'm happy to help fix. AFAICT, it's just a case of switching My take would be:
I realise there are other opinions on this. ipfs/go-log#60 has some related discussion with opinions on both sides. My position would be closer to this comment; Node, Docker, Nginx and other tooling follows this convention. Whatever you decide to do here, let me know and I'm happy to adjust as warranted. |
@leebenson what your proposing makes total sense to me. The only thing to keep in mind is that the plugins return a configuration to Ratify via stdout as json. Meaning other messages written to stdout need to be parsed. However, that functionality does exist and I can't see any reason not to switch the logger to use stderr for info, debug, and warn logs. We'll just have to make sure the Here's some link for more context on the parser and how the messages are passed from the plugin:
I also greatly appreciate your wiliness to contribute, if you need any assistance please feel free to reach out. You can also find me in the CNCF slack if DMs are quicker. |
Thanks @duffney. Does it seem accurate that it's just a case of swapping these lines for The reason I ask: I'm certainly happy to contribute, but my familiarity with Ratify is surface-level and I wouldn't want that to hinder progress. If suddenly sending logs to stdout is likely to impact plugins or existing customers, it may be better tackled by someone who is able to test for those scenarios. OTOH, if this is literally the 3 line change I'm hoping it is, then I'm happy to whip up a PR! |
I believe that's is accurate. My only additional suggestion would be to add a test that has two messages written to stdout. One that's json and another message to valid that the parser handles it properly. If it turns out I was wrong and everything blows up feel free to paste a Homer disappear meme and we can take a closer look. :) And thank you again for filing the issue. It's really good to know that other tools have expectations for where these messages are written to. Link to exec tests: https://github.com/ratify-project/ratify/blob/dev/pkg/common/plugin/exec_test.go |
What happened in your environment?
The default logger provided by
NewLogger()
is printing all messages to stderr:ratify/pkg/common/plugin/logger/logger.go
Lines 33 to 34 in e9152c9
What did you expect to happen?
I'd expect that at least
info
anddebug
level logs would be printed to stdout.What version of Kubernetes are you running?
No response
What version of Ratify are you running?
No response
Anything else you would like to add?
This is causing at least one customer issue at Datadog. An Agent reading from a Kubernetes pod's console output is interpreting info/debug logs as errors due to the stderr stream.
Are you willing to submit PRs to contribute to this bug fix?
The text was updated successfully, but these errors were encountered: