From 2050238d0ca7c080d8c7bfe2a072f554ab92140f Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 3 Jan 2020 09:58:01 +1000 Subject: [PATCH] DEV: Log to STDOUT if RAILS_ENABLE_TEST_LOG (#8650) The env var `RAILS_ENABLE_TEST_LOG` didn't seem to do anything if enabled. This now sets the logger to STDOUT if `RAILS_ENABLE_TEST_LOG` is enabled and also introduces `RAILS_TEST_LOG_LEVEL` so the level of the logging in the console can be provided (default info). Note: I am not sure if the original behaviour is expected. I can add an additional env var to enable the STDOUT logging if required --- config/environments/test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index da7b6f2ef3b..bbb7614e80f 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -47,7 +47,10 @@ Discourse::Application.configure do config.eager_load = false - unless ENV['RAILS_ENABLE_TEST_LOG'] + if ENV['RAILS_ENABLE_TEST_LOG'] + config.logger = Logger.new(STDOUT) + config.log_level = ENV['RAILS_TEST_LOG_LEVEL'].present? ? ENV['RAILS_TEST_LOG_LEVEL'].to_sym : :info + else config.logger = Logger.new(nil) config.log_level = :fatal end