From ace524e84c8b440164863eea10f6cc5ca5b91620 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Tue, 26 Nov 2024 15:15:31 +0900 Subject: [PATCH] daemon: setup global logger on Windows Signed-off-by: Shizuo Fujita --- lib/fluent/daemon.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/fluent/daemon.rb b/lib/fluent/daemon.rb index 628900c4b6..97a2c29b21 100644 --- a/lib/fluent/daemon.rb +++ b/lib/fluent/daemon.rb @@ -10,4 +10,23 @@ server_module = Fluent.const_get(ARGV[0]) worker_module = Fluent.const_get(ARGV[1]) params = JSON.parse(ARGV[2]) + +# Invoke Fluent::Supervisor#configure to setup global logger +opts = { + daemonize: params["daemonize"], + inline_config: params["inline_config"], + config_path: params["fluentd_conf_path"], + conf_encoding: params["conf_encoding"], + config_file_type: params["config_file_type"].to_sym, + log_path: params["log_path"], + log_rotate_age: params["log_rotate_age"], + log_rotate_size: params["log_rotate_size"], + log_level: params["log_level"], + use_v1_config: params["use_v1_config"], + chuser: params["chuser"], + chgroup: params["chgroup"], +} +server = Fluent::Supervisor.new(opts) +server.configure + ServerEngine::Daemon.run_server(server_module, worker_module) { Fluent::Supervisor.serverengine_config(params) }