kit
kit copied to clipboard
StdLibAdapter doesn't correctly recognize panics from net/http when running a http server
When running a http server using the stdlib's net/http (the idiomatic way to do this in Go) and when using stdlog.SetOutput(log.NewStdlibAdapter(logger)), any panics recovered from by net/http and then printed out will be mangled. Only the top line will be shown in the msg field. Additionally, the file field is wrong.
ts=2016-04-04T10:49:21Z caller=stdlib.go:89 file="http: panic serving 10.0.2.2:64629"
msg="runtime error: invalid memory address or nil pointer dereference"
I am investigating a bit. Part of the problem is without including log.Lshortfile in the stdlib log flags the regexp in StdlibAdapter mistakes the "http: .... port" substring for a "file name:line number" string.
Capturing the multi-line stack trace is another problem.