From 810f2d8a0e6720568a963462e538daa5c692ace3 Mon Sep 17 00:00:00 2001 From: "Joshua C. Randall" Date: Fri, 1 Jun 2018 18:53:29 +0000 Subject: [PATCH] 13558: add req_id as a tag to Rails.logger closes #13558 Arvados-DCO-1.1-Signed-off-by: Joshua C. Randall --- services/api/app/controllers/application_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb index ba7c07d272..71176056fa 100644 --- a/services/api/app/controllers/application_controller.rb +++ b/services/api/app/controllers/application_controller.rb @@ -382,7 +382,9 @@ class ApplicationController < ActionController::Base req_id = "req-" + Random::DEFAULT.rand(2**128).to_s(36)[0..19] end response.headers['X-Request-Id'] = Thread.current[:request_id] = req_id - yield + Rails.logger.tagged(req_id) do + yield + end Thread.current[:request_id] = nil end -- 2.30.2