Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When passing the config/settings data to the `.apply_config_value` method of Vmdb::Loggers, if the value was set to `DEBUG` the level wouldn't be changed in the lower level logger to reflect that. This is because the MulticastLogger is instantiated and defaulted at DEBUG, but the logger it casts to (normally an instance of VMDBLogger) would have it's level defaulted to `info`. When `.apply_config_value` is then called, it would compare the old value to the new one, and see it as the same, even though it was different under the covers. This means when a user attempts to do a `$log.debug "my message"`, the message would then not be applied. The fix here effectively makes sure we are defaulting the lower level logger to the same log level as the parent, or the MulticastLogger. When `.apply_config_value` is then eventually called, if the setting is set to `DEBUG`, nothing will change, but the level will be set properly for the lower level logger. Anything level set higher than DEBUG will function as it has. * * * There was also some additional tests added to the new test file, `spec/lib/vmdb/loggers_spec.rb`, that covered some of the quirks of log levels in a container config. Since `$container_log` is set to use the `lib/vmdb/loggers/container_logger.rb`, this means it's `#level=` method is set to override the default and always set itself to "DEBUG". This is a bit confusing at first glace if you are trying to grok what is happening in `lib/vmdb/loggers.rb`, as it can seem like the whole thing wouldn't work as expected, and the level for the $container_log would be overwritten with each log type.
- Loading branch information