-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Logging With Concurrency #99
Comments
The given example will die early, not always writing all lines. I haven't been able to reproduce this under the following example, but this should at least ensure all lines are written.
|
I have used your example and it still doesn't log the messages correctly. This is a section from the output:
|
You need to hold a mutex while writing. Should be easy to have that in |
Thanks for filing this issue @mattnenterprise, you're right that zap does not protect multiple Write calls. In this case, I don't think having a lock in the I think we'll have to enforce this in the
|
"go" do not ensure the code output in line, which has no matter with zap log. |
Logging in the timeout handler was added as part of tektoncd#731 cuz it helped us debug when the timeout handler didn't work as expected. Unfortunately it looks like the logger we're using can't be used in multiple go routines (uber-go/zap#99 may be related). Removing this logging to fix tektoncd#1124, hopefully can find a safe way to add logging back in tektoncd#1307.
Logging in the timeout handler was added as part of #731 cuz it helped us debug when the timeout handler didn't work as expected. Unfortunately it looks like the logger we're using can't be used in multiple go routines (uber-go/zap#99 may be related). Removing this logging to fix #1124, hopefully can find a safe way to add logging back in #1307.
I tried using this logger in a concurrent application, but the messages will run overtop of each other in the log. I am wondering if I am using it wrong, or the library isn't concurrent safe. I have a simple example:
Here is a section of output from the above program:
The text was updated successfully, but these errors were encountered: