mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #142 from jjhuff/log_apiserver_panic
When the apiserver panics, log a stacktrace.
This commit is contained in:
commit
af6903d22b
@ -23,6 +23,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||||
@ -77,7 +78,7 @@ func (server *ApiServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
if x := recover(); x != nil {
|
if x := recover(); x != nil {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
fmt.Fprint(w, "apiserver panic. Look in log for details.")
|
fmt.Fprint(w, "apiserver panic. Look in log for details.")
|
||||||
log.Printf("ApiServer panic'd: %#v\n", x)
|
log.Printf("ApiServer panic'd: %#v\n%s\n", x, debug.Stack())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
log.Printf("%s %s", req.Method, req.RequestURI)
|
log.Printf("%s %s", req.Method, req.RequestURI)
|
||||||
|
Loading…
Reference in New Issue
Block a user