Skip to content

Commit

Permalink
Fix bug that log level in system config doesn't affect
Browse files Browse the repository at this point in the history
Signed-off-by: Yuta Iwama <[email protected]>
  • Loading branch information
ganmacs committed Dec 12, 2019
1 parent 340d1aa commit 6abee66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def build_system_config(conf)
opt = {}
Fluent::SystemConfig::SYSTEM_CONFIG_PARAMETERS.each do |param|
if @cl_opt.key?(param) && !@cl_opt[param].nil?
if param == :log_level && opt[:log_level] == Fluent::Log::LEVEL_INFO
if param == :log_level && @cl_opt[:log_level] == Fluent::Log::LEVEL_INFO
# info level can't be specified via command line option.
# log_level is info here, it is default value and <system>'s log_level should be applied if exists.
next
Expand Down
11 changes: 11 additions & 0 deletions test/test_supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,17 @@ def test_inline_config
assert_equal inline_config, sv.instance_variable_get(:@inline_config)
end

def test_log_level_affects
opts = Fluent::Supervisor.default_options
sv = Fluent::Supervisor.new(opts)

c = Fluent::Config::Element.new('system', '', { 'log_level' => 'error' }, [])
stub(sv).read_config { config_element('ROOT', '', {}, [c]) }

sv.configure
assert_equal Fluent::Log::LEVEL_ERROR, $log.level
end

def create_debug_dummy_logger
dl_opts = {}
dl_opts[:log_level] = ServerEngine::DaemonLogger::DEBUG
Expand Down

0 comments on commit 6abee66

Please sign in to comment.