Writing message to our logs when system panics and recovers (#6458)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
42fb1c5693
Коммит
b9e57591bf
@@ -13,13 +13,14 @@ import (
|
|||||||
l4g "github.com/alecthomas/log4go"
|
l4g "github.com/alecthomas/log4go"
|
||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/mattermost/platform/model"
|
|
||||||
"github.com/mattermost/platform/store"
|
|
||||||
"github.com/mattermost/platform/utils"
|
|
||||||
"github.com/rsc/letsencrypt"
|
"github.com/rsc/letsencrypt"
|
||||||
"github.com/tylerb/graceful"
|
"github.com/tylerb/graceful"
|
||||||
"gopkg.in/throttled/throttled.v2"
|
"gopkg.in/throttled/throttled.v2"
|
||||||
"gopkg.in/throttled/throttled.v2/store/memstore"
|
"gopkg.in/throttled/throttled.v2/store/memstore"
|
||||||
|
|
||||||
|
"github.com/mattermost/platform/model"
|
||||||
|
"github.com/mattermost/platform/store"
|
||||||
|
"github.com/mattermost/platform/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
@@ -38,6 +39,14 @@ var allowedMethods []string = []string{
|
|||||||
"DELETE",
|
"DELETE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RecoveryLogger struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rl *RecoveryLogger) Println(i ...interface{}) {
|
||||||
|
l4g.Error("Please check the std error output for the stack trace")
|
||||||
|
l4g.Error(i)
|
||||||
|
}
|
||||||
|
|
||||||
type CorsWrapper struct {
|
type CorsWrapper struct {
|
||||||
router *mux.Router
|
router *mux.Router
|
||||||
}
|
}
|
||||||
@@ -158,7 +167,7 @@ func StartServer() {
|
|||||||
Timeout: TIME_TO_WAIT_FOR_CONNECTIONS_TO_CLOSE_ON_SERVER_SHUTDOWN,
|
Timeout: TIME_TO_WAIT_FOR_CONNECTIONS_TO_CLOSE_ON_SERVER_SHUTDOWN,
|
||||||
Server: &http.Server{
|
Server: &http.Server{
|
||||||
Addr: utils.Cfg.ServiceSettings.ListenAddress,
|
Addr: utils.Cfg.ServiceSettings.ListenAddress,
|
||||||
Handler: handlers.RecoveryHandler(handlers.PrintRecoveryStack(true))(handler),
|
Handler: handlers.RecoveryHandler(handlers.RecoveryLogger(&RecoveryLogger{}), handlers.PrintRecoveryStack(true))(handler),
|
||||||
ReadTimeout: time.Duration(*utils.Cfg.ServiceSettings.ReadTimeout) * time.Second,
|
ReadTimeout: time.Duration(*utils.Cfg.ServiceSettings.ReadTimeout) * time.Second,
|
||||||
WriteTimeout: time.Duration(*utils.Cfg.ServiceSettings.WriteTimeout) * time.Second,
|
WriteTimeout: time.Duration(*utils.Cfg.ServiceSettings.WriteTimeout) * time.Second,
|
||||||
},
|
},
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user