From af638ca43d4cd3c428df6b3df0fb42d9dfe16e07 Mon Sep 17 00:00:00 2001 From: Kai <4247133+kaihen@users.noreply.github.com> Date: Tue, 4 May 2021 18:39:51 +0200 Subject: [PATCH] Added parameter for log level (#2546) * Added parameter for log level * Added fix for Rubocop + RSpec check and `RAILS_LOG_LEVEL` is now optionally. Default value/log level is `info`. * Set default log level from `info` to `debug` for RSpec check... * Update application.rb Moving it to config/environments/production.rb * Update production.rb * Update production.rb Forgot to change the default logging level again from `:debug` to :info` Co-authored-by: kaihen <> --- config/environments/production.rb | 5 +++-- sample.env | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 30215a7c..54f40706 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -125,6 +125,9 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify + # Specify the log level + config.log_level = ENV["RAILS_LOG_LEVEL"].present? ? ENV['RAILS_LOG_LEVEL'].to_sym : :info + # Use Lograge for logging config.lograge.enabled = true @@ -141,8 +144,6 @@ Rails.application.configure do "#{time} - #{severity}: #{msg} \n" end - config.log_level = :info - # Prepend all log lines with the following tags. config.log_tags = [:request_id, :remote_ip] diff --git a/sample.env b/sample.env index 2d62c0c7..5cebc7fb 100644 --- a/sample.env +++ b/sample.env @@ -259,6 +259,11 @@ ENABLE_SSL=true # RAILS_LOG_REMOTE_PORT=9999 # RAILS_LOG_REMOTE_TAG=greenlight +# Specify the log level +# Allowed values are: debug|info|warn|error|fatal|unknown +# For details, see: https://docs.ruby-lang.org/en/master/Logger.html +#RAILS_LOG_LEVEL=info + # Database settings # # Greenlight may work out of the box with sqlite3, but for production it is recommended to use postgresql.