Skip to content

Commit

Permalink
http_server: Replace Console.logger of all related threads
Browse files Browse the repository at this point in the history
Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie authored and kenhys committed Apr 4, 2024
1 parent e285c76 commit e9886fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/fluent/plugin_helper/http_server/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/plugin_helper/test_http_server_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9886fc

Please sign in to comment.