-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add a 'stdlog' log type. #54146
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
base: master
Are you sure you want to change the base?
Add a 'stdlog' log type. #54146
Conversation
The stdlog log type is similar to the errorlog log type, but it does output to stderr and makes sure the output is formatted as JSON. This is in particular useful for environments running in docker containers, with the stderr being collected by log aggregation services like Grafana or Google Cloud logging.
|
Why not stdout? |
You may be right, in docker environments it does not matter if it is send to stdout or stderr. But for a very long time it has been a convention to send diagnostics to stderr and leave stdout free for I/O functions of the program in question. I like that old convention personally and send my diagnostics in all programs to stderr. If running the program manually it makes it easier to capture diagnostics. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
|
Hi, Thanks again for your pull request, and sorry for not following up earlier. I had also thought about adding a logging provider for stdout a while back, since it’s much more convenient for containers, but I didn’t have the time so many thanks for picking it up. Symfony also uses stderr (see https://symfony.com/doc/current/logging.html), so I think it’s fine to go with that. What do you think about renaming it to just stderr instead of stdlog? I’ll try to give it a proper review and test next week. |
I thought about just using plain stderr at first as well, but that would leave no clue about the format of the lines. Normally stderr is an unstructured byte stream, but we want it to conform to a format, namely lines of json records. I did thus settle with stdlog, which I liked better. |
The stdlog log type is similar to the errorlog log type, but it does output to stderr and makes sure the output is formatted as JSON. This is in particular useful for environments running in docker containers, with the stderr being collected by log aggregation services like Grafana or Google Cloud logging.
Summary
TODO
Checklist