-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Shouldn't middleware.Logger's default output to be the same as echo.Logger #1260
Comments
At the glance, this sounds reasonable to me, however it also sounds backward incompatible. If all of the sudden stdout logging is gone, that might break some setups. Esp., that it is the recommended way of logging for Docker, so people may actually rely on it quite a bit. So I'm with you, I just don't see an easy way to handle this. Maybe keep it in mind for V4? Thoughts @vishr ? |
V4 is here but just for compatibility with Go Modules. V5 then? |
I think
I am ok with this change, please send a PR. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
After trying to fix this issue, I've stumbled upon some weird unit test. In the function TestLoggerIPAddress that call |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue Description
The current behavior of middleware.Logger() is kind of counter-intuitive. When I set echo.Logger.SetOutput to be something else, I expect all log from echo should go to them. But right now if I use echo.Use(middleware.Logger()), the log will still write to os.Stdout.
I think the DefaultLoggerConfig.Output should be set to nil, and at the end of middleware.LoggerWithConfig, if config.Output == nil then use context.Logger.Output() instead
The text was updated successfully, but these errors were encountered: