Skip to content

Commit

Permalink
fix log_requests_level misconfiguration (#24056)
Browse files Browse the repository at this point in the history
* use the correct raw value for setting log requests level
  • Loading branch information
Peter Wilson authored Nov 8, 2023
1 parent 35545f5 commit 0f5f648
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions vault/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
})
}
Expand Down

0 comments on commit 0f5f648

Please sign in to comment.