diff --git a/lib/fluent/supervisor.rb b/lib/fluent/supervisor.rb index 543ce6a32d..5c1018c9c7 100644 --- a/lib/fluent/supervisor.rb +++ b/lib/fluent/supervisor.rb @@ -697,7 +697,7 @@ def setup_global_logger(supervisor: false) actual_log_path = @log_path # We need to prepare a unique path for each worker since Windows locks files. - if Fluent.windows? && rotate + if Fluent.windows? && rotate && @log_path && @log_path != "-" actual_log_path = Fluent::Log.per_process_path(@log_path, process_type, worker_id) end diff --git a/test/test_supervisor.rb b/test/test_supervisor.rb index 64915a7e4a..d684b5eeb5 100644 --- a/test/test_supervisor.rb +++ b/test/test_supervisor.rb @@ -621,6 +621,19 @@ def test_logger_with_rotate_age_and_rotate_size(rotate_age) assert_equal 10, $log.out.instance_variable_get(:@shift_size) end + def test_can_start_with_rotate_but_no_log_path + config_path = "#{@tmp_dir}/empty.conf" + write_config config_path, "" + + sv = Fluent::Supervisor.new( + config_path: config_path, + log_rotate_age: 5, + ) + sv.__send__(:setup_global_logger) + + assert_true $log.stdout? + end + sub_test_case "system log rotation" do def parse_text(text) basepath = File.expand_path(File.dirname(__FILE__) + '/../../')