Skip to content
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

DefaultHTTPErrorHandler does not log #2585

Closed
3 tasks done
linglingqi007 opened this issue Jan 31, 2024 · 3 comments
Closed
3 tasks done

DefaultHTTPErrorHandler does not log #2585

linglingqi007 opened this issue Jan 31, 2024 · 3 comments

Comments

@linglingqi007
Copy link

Issue Description

DefaultHTTPErrorHandler does not record the err returned by handler

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

image

Actual behaviour

No errors logged
image

Steps to reproduce

Returns an error in the handler

Working code to debug

package main

func main() {
    e := echo.New()
    e.GET("/", func(ctx echo.Context) error {
        return fmt.Errorf("hello")
    })
    e.Start(":7123")
}

Version/commit

v4.11.4

@aldas
Copy link
Contributor

aldas commented Jan 31, 2024

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:

@linglingqi007
Copy link
Author

linglingqi007 commented Jan 31, 2024

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:

The feeling of documentation can be misleading.
image

image

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.

@aldas
Copy link
Contributor

aldas commented Jan 31, 2024

I will take a look at Echo docs and see if I can improve things.

Notes for other readers in future:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants