gin-gonic / gin

Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
https://gin-gonic.com/
MIT License
78.96k stars 8.02k forks source link

warning about "Logger and Recovery middleware" #1787

Open mvolkmann opened 5 years ago

mvolkmann commented 5 years ago

Description

Why is this output every time I start a gin server?

[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

I'm not doing anything explicitly with those middleware, so it must be part of what gin does by default.

thinkerou commented 5 years ago

@mvolkmann please see here https://github.com/gin-gonic/gin/blob/master/gin.go#L154, because you are using gin.Default() and it only is debug mode log, it don't appear on release mode.

mvolkmann commented 5 years ago

The warning makes it seem like I did something wrong and that I should investigate and fix it. If this is the expected behavior when using gin.Default(), wouldn’t it be better to be silent about that?

mikestead commented 5 years ago

@thinkerou are you able to confirm that this warning is more an info log message? i.e. there's no harm in creating an engine instance with the logger and recovery middleware attached