stdout / stderr logs #43
-
Hi, Starting the daemon, it looks all "information" logs goes into
Is it expected behavior to log this into |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Go uses stderr as output by default for their basic logging library (src/log/log.go). This is in compliance with the POSIX standard, which defines the three streams (stdin, stdout, stderr) as follows:
(see also https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html) This project uses the Go standard logger. It's certainly debatable if logs are "conventional output for a server application", since it's not comparable with say a CLI application. There has been a nice conversation on reddit about exactly this topic: https://www.reddit.com/r/golang/comments/15ndgdy/slog_splitting_stdoutstderr_streams/ Since Go 1.21, structured logging comes right out of the box (log/slog). I haven't had the time yet to properly check out slog, but I assume that we should be using it. While we're at that, we could also change the behavior so that regular logs go to stdout and warnings/errors go to stderr. To answer your question:
It is expected, but not necessarily intended in the long term. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the detailed answer. |
Beta Was this translation helpful? Give feedback.
Go uses stderr as output by default for their basic logging library (src/log/log.go).
This is in compliance with the POSIX standard, which defines the three streams (stdin, stdout, stderr) as follows:
(see also https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html)
This project uses the Go standard logger. It's certainly debatable if logs are "conventional output for a server application", since it's not comparable with say a CLI application. There has been a nice conversation on reddit about exactly this topic: https://…