-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Change standard output destination depending on log level #6459
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the effort here, and the solution is certainly nice, however I have trouble with this PR for two reasons:
- the logs can easily be filtered using the
level
field - this is a major backwards-incompatibility for all folks who are currently relying on logs being written to
stderr
It would've been nice if we adopted this strategy from day 0, but here we are and it's tricky to change something so fundamental.
On that basis, I'm inclined to not accept this PR, but I'm interested in your response to the above and the opinions of my fellow maintainers.
Yes, I don't think this is good idea either. It will be too easy to inadvertently lose logs if you forget to read either stderr or stdout. Additionally it's not easy to change. I can imagine a scenario where you want levels Info, Warning and Error to go to stdout and Debug level output to stderr. Better to do this in your logging tool or when you capture these logs. |
I appreciate both of your opinions. I understood that those changes are not easy and can be solved with logging tools and that this modification is not appropriate |
I'm a bit sad that this will not be fixed. Writing errors to stdout seems like a major flaw and should be fixed, maybe in a major release. |
@dannykopping Google Cloud counts logs written to stderr as error logs and it makes sense why. This creates false positive alerts in case of Loki and makes it more challenging to monitor. It would be helpful to have this to be configurable Here is how other tool made similar change without breaking backwards compatibility GoogleCloudPlatform/cloud-sql-proxy#150 |
Having a flag like described in the linked PR sounds awesome as it maintains the mentioned backward compatibility. |
What this PR does / why we need it:
Since all log levels are output to stderr, logging and its filters are tainted by Loki's logs. To avoid this, we think it is a good idea to change the output destination depending on the level
Which issue(s) this PR fixes:
Fixes #5331
Special notes for your reviewer:
over level warning
Checklist
CHANGELOG.md
.docs/sources/upgrading/_index.md