Replies: 3 comments 5 replies
-
We might be able to influence gin logging by changing the argument of |
Beta Was this translation helpful? Give feedback.
-
This is where we create the request ID, I remember it was in the logging previously: https://github.com/epinio/epinio/blob/main/internal/cli/server/server.go#L271 |
Beta Was this translation helpful? Give feedback.
-
The go-logr is using non-descriptive log levels by design. If you want to log at a certain absolute level you can use +1 to using the Gin logger more in the server. |
Beta Was this translation helpful? Give feedback.
-
Ok, this is a broad topic, so I will try to focus only on specific things!
Error messages
We are missing them. That's a big problem while debugging, or trying to understand what's going on (#1130)
Anyway, at the end I've found what we were missing, basically in order to be logged by the Gin formatter we should add the errors in the Gin context with the c.Error
Adding this to the
Error
response will fix it, I will open a PR.Levels
This is quite confusing. In logr the verbosity is additive so a level 0/1 is for important stuff, and also in the
errorHandler
we can see that probably the V(1) was meant to be used to log the errorbut if we have a look at the log we are actually logging to level 2
and the logger was actually a fallback (
// this should not happen, but let's be cautious
)I'm not sure on how we should handle this but I would like to propose to avoid to use the int levels and just log with the
Info
orError
. If we need to have aDebug
level (probably yes) I would implement a specific method to get a logger with increased level, but "fixed", so we know that we can rely on the fact that the Debug logger will have a value of 2, and that maybe a Trace logger will have a level of 5.Trace/Request ID
I've seen that we are missing a trace or request ID that is very useful to trace and correlate logs of the same request. Probably this was not felt as a need because we are still in an early development phase, and there are no concurrent requests.
Log format
At the moment we have two format (as far as I've seen), the one used by the stdr logger with logr and the one used by the Gin formatter.
I would choose one between the twos:
Beta Was this translation helpful? Give feedback.
All reactions