Skip to content

How to filter log entries of my app? #1926

Answered by aldas
Kukulkano asked this question in Q&A
Discussion options

You must be logged in to vote

I think those messages are logged by http server logger. You could try to set http.Server.ErrorLog or global logger to discard input

log.SetOutput(ioutil.Discard)

This is how you can setErrorLog

func main() {
	e := echo.New()
	s := http.Server{
		Addr: ":8082",
		Handler: e,
		ErrorLog: nil, // set here logger to no-op logger
	}
	if err := s.ListenAndServe(); err != http.ErrServerClosed {
		log.Fatal(err)
	}
}

and here is example for autoTLS with http.Server https://echo.labstack.com/cookbook/auto-tls/#server check customHTTPServer function

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Kukulkano
Comment options

@aldas
Comment options

@Kukulkano
Comment options

@Kukulkano
Comment options

Answer selected by Kukulkano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants