Even with GIN_MODE=release, gin still prints the full request log to console, which can seriously slow down performance.
We've had to disable it temporarily during performance testing by redirecting it to /dev/null.
Please document how to properly enable/disable the request log.
Thank you
Do you use gin.Default() ? If so you have to use gin.New() and add the recovery middleware (if you still want it) because gin.Default() add the Logger and Recovery middleware.
Ah, I see. It's probably worth documenting that to be more explicit.
Thank you for the explanation.
It is documented in README.
Thats not documented very well. That doesnt explain what the logger or recovery middleware are.
See the PR https://github.com/gin-gonic/gin/pull/1056 improve the document.
@zirkome Even using Default() still prints out pretty verbose message when using it in unit tests. Maybe I am doing something wrong ?
@ldelossa That's the thing the gin.Default() function includes a logger by default. If you want to control the logging you should use a custom Gin router with gin.New() and add whatever global middleware you want/need.
Most helpful comment
Do you use
gin.Default()? If so you have to usegin.New()and add the recovery middleware (if you still want it) becausegin.Default()add the Logger and Recovery middleware.