logging: Ensure slog error level logs don't print stack traces (#7512)

This commit is contained in:
Francis Lavoie
2026-03-03 16:44:42 -05:00
committed by GitHub
parent d935a6956c
commit 45cf61b127
3 changed files with 17 additions and 6 deletions

View File

@@ -484,7 +484,13 @@ func setResourceLimits(logger *zap.Logger) func() {
// See https://pkg.go.dev/runtime/debug#SetMemoryLimit
_, _ = memlimit.SetGoMemLimitWithOpts(
memlimit.WithLogger(
slog.New(zapslog.NewHandler(logger.Core())),
slog.New(zapslog.NewHandler(
logger.Core(),
zapslog.WithName("memlimit"),
// the default enables traces at ERROR level, this disables
// them by setting it to a level higher than any other level
zapslog.AddStacktraceAt(slog.Level(127)),
)),
),
memlimit.WithProvider(
memlimit.ApplyFallback(