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

improve startup error logging #4093

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-startup-error-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fix startup error logging

We've fixed the startup error logging, so that users will the reason for a failed
startup even on "error" log level. Previously they would only see it on "info" log level.
Also in a lot of cases the reason for the failed shutdown was omitted.

https://github.com/owncloud/ocis/pull/4093
5 changes: 3 additions & 2 deletions services/app-provider/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("server", cfg.Service.Name).
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/app-registry/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("server", cfg.Service.Name).
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/auth-basic/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("server", cfg.Service.Name).
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/auth-bearer/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("server", cfg.Service.Name).
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/auth-machine/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/frontend/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/gateway/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/graph-explorer/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ func Server(cfg *config.Config) *cli.Command {
Msg("Failed to start server")
}
return err
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("transport", "http").
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/graph/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ func Server(cfg *config.Config) *cli.Command {

gr.Add(func() error {
return server.Run()
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("transport", "http").
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/groups/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("server", cfg.Service.Name).
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/idp/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ func Server(cfg *config.Config) *cli.Command {

gr.Add(func() error {
return server.Run()
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Str("transport", "http").
Err(err).
Msg("Shutting down server")

cancel()
Expand Down
5 changes: 3 additions & 2 deletions services/nats/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func Server(cfg *config.Config) *cli.Command {
return <-err
}

}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Msg("Shutting down server")

natsServer.Shutdown()
Expand Down
5 changes: 4 additions & 1 deletion services/ocdav/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ func Server(cfg *config.Config) *cli.Command {

return s.Run()
}, func(err error) {
logger.Info().Err(err).Str("server", c.Command.Name).Msg("Shutting down server")
logger.Error().
Err(err).
Str("server", c.Command.Name).
Msg("Shutting down server")
cancel()
})

Expand Down
7 changes: 4 additions & 3 deletions services/ocs/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Server(cfg *config.Config) *cli.Command {
)

if err != nil {
logger.Info().
logger.Error().
Err(err).
Str("transport", "http").
Msg("Failed to initialize server")
Expand All @@ -73,8 +73,9 @@ func Server(cfg *config.Config) *cli.Command {

gr.Add(func() error {
return server.Run()
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("transport", "http").
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/proxy/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ func Server(cfg *config.Config) *cli.Command {

gr.Add(func() error {
return server.Run()
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", "http").
Msg("Shutting down server")

Expand Down
5 changes: 4 additions & 1 deletion services/search/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ func Server(cfg *config.Config) *cli.Command {
)

gr.Add(grpcServer.Run, func(_ error) {
logger.Info().Str("server", "grpc").Msg("shutting down server")
logger.Error().
Err(err).
Str("server", "grpc").
Msg("shutting down server")
cancel()
})

Expand Down
5 changes: 3 additions & 2 deletions services/sharing/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/storage-publiclink/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/storage-shares/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/storage-system/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/storage-users/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
5 changes: 3 additions & 2 deletions services/store/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func Server(cfg *config.Config) *cli.Command {
grpc.Metrics(metrics),
)

gr.Add(server.Run, func(_ error) {
logger.Info().
gr.Add(server.Run, func(err error) {
logger.Error().
Err(err).
Str("server", "grpc").
Msg("Shutting down server")

Expand Down
6 changes: 5 additions & 1 deletion services/thumbnails/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ func Server(cfg *config.Config) *cli.Command {
)

gr.Add(service.Run, func(_ error) {
fmt.Println("shutting down grpc server")
logger.Error().
Err(err).
Str("server", "grpc").
Msg("Shutting down server")

cancel()
})

Expand Down
5 changes: 3 additions & 2 deletions services/users/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
return nil
}, func(_ error) {
logger.Info().
}, func(err error) {
logger.Error().
Err(err).
Str("server", cfg.Service.Name).
Msg("Shutting down server")

Expand Down
2 changes: 1 addition & 1 deletion services/web/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func Server(cfg *config.Config) *cli.Command {
Msg("Failed to start server")
}
return err
}, func(_ error) {
}, func(err error) {
logger.Info().
Str("transport", "http").
Msg("Shutting down server")
Expand Down
4 changes: 2 additions & 2 deletions services/webdav/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(func() error {
return server.Run()
}, func(err error) {
logger.Error().Err(err).Msg("error ")
logger.Info().
logger.Error().
Err(err).
Str("transport", "http").
Msg("Shutting down server")

Expand Down