From 770148058986515964ed9a17de6d9889748eff16 Mon Sep 17 00:00:00 2001 From: Quentin Champenois <26109239+Quentinchampenois@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:07:51 +0100 Subject: [PATCH] fix: Make the log_level configurable (#461) * fix: Make the log_level configurable * refactor: Add RAILS_LOG_LEVEL to .env-example * lint: Fix rubocop offenses --- .env-example | 4 +++- config/environments/production.rb | 3 ++- config/initializers/health_check.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env-example b/.env-example index f3e2b77287..40da902041 100644 --- a/.env-example +++ b/.env-example @@ -47,4 +47,6 @@ TRANSLATOR_ENABLED=0 TRANSLATOR_API_KEY= TRANSLATOR_HOST= TRANSLATOR_DELAY=0 -GALLERY_ANIMATION_ENABLE=0 \ No newline at end of file +GALLERY_ANIMATION_ENABLE=0 + +RAILS_LOG_LEVEL=warn \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index f461e9355d..5df88f7074 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -56,7 +56,8 @@ # Use the lowest log level to ensure availability of diagnostic information # when problems arise. - config.log_level = :info + # The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "warn").to_sym # Prepend all log lines with the following tags. config.log_tags = [:request_id] diff --git a/config/initializers/health_check.rb b/config/initializers/health_check.rb index 5f7a3c789f..1442b92a9e 100644 --- a/config/initializers/health_check.rb +++ b/config/initializers/health_check.rb @@ -17,7 +17,7 @@ config.include_error_in_response_body = false # Log level (success or failure message with error details is sent to rails log unless this is set to nil) - config.log_level = "info" + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "warn").to_sym # Timeout in seconds used when checking smtp server config.smtp_timeout = 30.0