From 53313e4a2d11d5fb87c0c1d87c63993107fc4c5d Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:58:07 +0100 Subject: [PATCH] Logging: Fix don't return an error trying to initialize the file logger (#42952) (#44867) Fixes #42897 Co-authored-by: Marcus Efraimsson (cherry picked from commit 7f2d3055d8b16510486e47c4b63e1ba6493c189b) Co-authored-by: bolshoytoster <91278344+bolshoytoster@users.noreply.github.com> --- pkg/infra/log/log.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/infra/log/log.go b/pkg/infra/log/log.go index a4d38d84256..da9395c410d 100644 --- a/pkg/infra/log/log.go +++ b/pkg/infra/log/log.go @@ -417,7 +417,7 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error { dpath := filepath.Dir(fileName) if err := os.MkdirAll(dpath, os.ModePerm); err != nil { _ = level.Error(root).Log("Failed to create directory", "dpath", dpath, "err", err) - return errutil.Wrapf(err, "failed to create log directory %q", dpath) + continue } fileHandler := NewFileWriter() fileHandler.Filename = fileName @@ -429,7 +429,7 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error { fileHandler.Maxdays = sec.Key("max_days").MustInt64(7) if err := fileHandler.Init(); err != nil { _ = level.Error(root).Log("Failed to initialize file handler", "dpath", dpath, "err", err) - return errutil.Wrapf(err, "failed to initialize file handler") + continue } loggersToClose = append(loggersToClose, fileHandler)