From 483d847b001201201a70136eec6df415a04925e0 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 13 Mar 2020 11:07:46 +0100 Subject: [PATCH 1/3] Use `eager_load = true` in production and staging environments --- config/environments/production.rb | 2 +- config/environments/staging.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index c92b4ee9bc..fa19d313f6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,7 +1,7 @@ Openfoodnetwork::Application.configure do # Settings specified here will take precedence over those in config/application.rb - config.eager_load = false + config.eager_load = true # Code is not reloaded between requests config.cache_classes = true diff --git a/config/environments/staging.rb b/config/environments/staging.rb index c92b4ee9bc..fa19d313f6 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,7 +1,7 @@ Openfoodnetwork::Application.configure do # Settings specified here will take precedence over those in config/application.rb - config.eager_load = false + config.eager_load = true # Code is not reloaded between requests config.cache_classes = true From 7bc29769cddd617e02b05a6d36597753ca0840d5 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 13 Mar 2020 14:17:09 +0100 Subject: [PATCH 2/3] Fix logging configs for Rails 4 --- config/environments/production.rb | 9 ++------- config/environments/staging.rb | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index fa19d313f6..22950996c2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -38,13 +38,8 @@ Openfoodnetwork::Application.configure do # Note: This config no longer works with our new logging strategy # config.log_level = :debug - # Configure logging for Rails 3.2: - config.logger = ActiveSupport::TaggedLogging.new(Logger.new(Rails.root.join("log", "#{Rails.env}.log"))) - config.logger.level = Logger::INFO - config.logger.formatter = Logger::Formatter.new - config.logger.datetime_format = "%Y-%m-%d %H:%M:%S" - # Once we get to Rails 4.0, we can replace the above with: - #config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } + # Configure logging: + config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } # Use a different cache store in production memcached_value_max_megabytes = ENV.fetch("MEMCACHED_VALUE_MAX_MEGABYTES", 1).to_i diff --git a/config/environments/staging.rb b/config/environments/staging.rb index fa19d313f6..22950996c2 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -38,13 +38,8 @@ Openfoodnetwork::Application.configure do # Note: This config no longer works with our new logging strategy # config.log_level = :debug - # Configure logging for Rails 3.2: - config.logger = ActiveSupport::TaggedLogging.new(Logger.new(Rails.root.join("log", "#{Rails.env}.log"))) - config.logger.level = Logger::INFO - config.logger.formatter = Logger::Formatter.new - config.logger.datetime_format = "%Y-%m-%d %H:%M:%S" - # Once we get to Rails 4.0, we can replace the above with: - #config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } + # Configure logging: + config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } # Use a different cache store in production memcached_value_max_megabytes = ENV.fetch("MEMCACHED_VALUE_MAX_MEGABYTES", 1).to_i From 433ae0081822683a599224e37435838e0fa24c2e Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 18 Mar 2020 12:32:24 +0100 Subject: [PATCH 3/3] Ensure :info log level is set in Rails 4 --- config/environments/production.rb | 4 ++-- config/environments/staging.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 22950996c2..9c61ebaab0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -35,8 +35,8 @@ Openfoodnetwork::Application.configure do # Use https in email links config.action_mailer.default_url_options = { protocol: 'https' } - # Note: This config no longer works with our new logging strategy - # config.log_level = :debug + # Set log level (default is :debug in Rails 4) + config.log_level = :info # Configure logging: config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" } diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 22950996c2..9c61ebaab0 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -35,8 +35,8 @@ Openfoodnetwork::Application.configure do # Use https in email links config.action_mailer.default_url_options = { protocol: 'https' } - # Note: This config no longer works with our new logging strategy - # config.log_level = :debug + # Set log level (default is :debug in Rails 4) + config.log_level = :info # Configure logging: config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" }