-
Notifications
You must be signed in to change notification settings - Fork 600
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
Cannot use lumberjack in Go WebServer App? #25
Comments
Oh no no. Lumberjack is totally thread/goroutine safe from a single process. Any number of goroutines can write to it safely. It is only if multiple processes write to it that you can experience problems. |
YES great! thank you very much |
@natefinch what would be an alternative if multiple processes write to the same log file? we are facing this issue in windows |
Well, you probably shouldn't do that anyway. You can easily get interspersed writes, like one process writes the first half of a log message, then the other process writes the first half of their log message, then both write the second half... and that even assumes that one doesn't just lock the file and exclude the other. The only way I can think to make that work is to have a third process that both send their log messages to, and it serializes them, and then it handles the log rotation. But it seems easier just to let each process have its own log file. |
"Lumberjack assumes that only one process is writing to the output files. Using the same lumberjack configuration from multiple processes on the same machine will result in improper behavior."
Is it means that we shouldn't use Lumberjack in Golang WebServer or any Go application with Go routines concurrently write to the log file?
thank you
The text was updated successfully, but these errors were encountered: