Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions test/test_supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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__) + '/../../')
Expand Down