Closed linglingqi007 closed 5 months ago
DefaultHTTPErrorHandler is not meant to log errors. It is meant to send error responses. It logs errors only for cases when writing the response failed. To log errors use:
DefaultHTTPErrorHandler is not meant to log errors. It is meant to send error responses. It logs errors only for cases when writing the response failed. To log errors use:
- Older logger middleware: https://github.com/labstack/echo/blob/master/middleware/logger.go
- Newer request logger https://github.com/labstack/echo/blob/master/middleware/request_logger.go
The feeling of documentation can be misleading.
The other part of the tutorial documents both the ERR returned by the handler and the ERR that ultimately sends the response.
But it's actually as you said,It logs errors only for cases when writing the response failed.
I will take a look at Echo docs and see if I can improve things.
Notes for other readers in future:
Issue Description
DefaultHTTPErrorHandler does not record the err returned by handler
Checklist
Expected behaviour
Actual behaviour
No errors logged
Steps to reproduce
Returns an error in the handler
Working code to debug
Version/commit
v4.11.4