Backport of fix `log_requests_level` misconfiguration into release/1.14.x (#24058)

* backport of commit 0f5f648c1c9505e975ea2d479aa5e9f27bb1d935

* changelog

---------

Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
This commit is contained in:
hc-github-team-secure-vault-core 2023-11-08 05:01:32 -05:00 committed by GitHub
parent 1014555b27
commit 86d4f98ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

3
changelog/24058.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
core/config: Use correct HCL config value when configuring `log_requests_level`.
```

View File

@ -1238,8 +1238,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")
@ -1303,8 +1303,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)

View File

@ -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()))
})
}