From e9886fc1828223ca107445189bdf5c5675f5f623 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Wed, 15 Feb 2023 09:26:54 +0900 Subject: [PATCH] http_server: Replace Console.logger of all related threads Signed-off-by: Takuro Ashie --- lib/fluent/plugin_helper/http_server/server.rb | 3 +++ test/plugin_helper/test_http_server_helper.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/fluent/plugin_helper/http_server/server.rb b/lib/fluent/plugin_helper/http_server/server.rb index 3d54aa3ba4..1434df2f5f 100644 --- a/lib/fluent/plugin_helper/http_server/server.rb +++ b/lib/fluent/plugin_helper/http_server/server.rb @@ -55,10 +55,13 @@ def initialize(addr:, port:, logger:, default_app: nil, tls_context: nil) end def start(notify = nil) + Console.logger = Fluent::Log::ConsoleAdapter.wrap(@logger) @logger.debug("Start async HTTP server listening #{@uri}") Async do |task| + Console.logger = Fluent::Log::ConsoleAdapter.wrap(@logger) @server_task = task.async do + Console.logger = Fluent::Log::ConsoleAdapter.wrap(@logger) @server.run end if notify diff --git a/test/plugin_helper/test_http_server_helper.rb b/test/plugin_helper/test_http_server_helper.rb index f2d2d1c9aa..c198a364f1 100644 --- a/test/plugin_helper/test_http_server_helper.rb +++ b/test/plugin_helper/test_http_server_helper.rb @@ -133,6 +133,7 @@ def start_https_request(addr, port, verify: true, cert_path: nil, selfsigned: tr error = nil Async do + Console.logger = Fluent::Log::ConsoleAdapter.wrap(NULL_LOGGER) begin response = yield(client) rescue => e # Async::Reactor rescue all error. handle it by myself