From 0f5f648c1c9505e975ea2d479aa5e9f27bb1d935 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 8 Nov 2023 09:22:25 +0000 Subject: [PATCH] fix `log_requests_level` misconfiguration (#24056) * use the correct raw value for setting log requests level --- vault/core.go | 8 ++++---- vault/core_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vault/core.go b/vault/core.go index 021051944a6b..264dab0ed546 100644 --- a/vault/core.go +++ b/vault/core.go @@ -1228,8 +1228,8 @@ func NewCore(conf *CoreConfig) (*Core, error) { return nil, err } - // Log level - c.configureLogRequestLevel(conf.RawConfig.LogLevel) + // Log requests level + c.configureLogRequestsLevel(conf.RawConfig.LogRequestsLevel) // Quotas quotasLogger := conf.Logger.Named("quotas") @@ -1285,8 +1285,8 @@ func (c *Core) configureListeners(conf *CoreConfig) error { return nil } -// configureLogRequestLevel configures the Core with the supplied log level. -func (c *Core) configureLogRequestLevel(level string) { +// configureLogRequestsLevel configures the Core with the supplied log requests level. +func (c *Core) configureLogRequestsLevel(level string) { c.logRequestsLevel = uberAtomic.NewInt32(0) lvl := log.LevelFromString(level) diff --git a/vault/core_test.go b/vault/core_test.go index 5e777fe1de61..983235a24036 100644 --- a/vault/core_test.go +++ b/vault/core_test.go @@ -254,12 +254,12 @@ func TestNewCore_configureLogRequestLevel(t *testing.T) { t.Run(name, func(t *testing.T) { t.Parallel() - // We need to supply a logger, as configureLogRequestLevel emits + // We need to supply a logger, as configureLogRequestsLevel emits // warnings to the logs in certain circumstances. core := &Core{ logger: corehelpers.NewTestLogger(t), } - core.configureLogRequestLevel(tc.level) + core.configureLogRequestsLevel(tc.level) require.Equal(t, tc.expectedLevel, log.Level(core.logRequestsLevel.Load())) }) }