From 90cd2e0ba26f737b010247a809e57fadc73af835 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 6 Oct 2025 12:51:07 +1100 Subject: [PATCH] Make log-level configurable in staging The new comment and code come from the Rails 8.0 default files. --- config/environments/production.rb | 4 +--- config/environments/staging.rb | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 2bd5bc27bc..ff8394a821 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -68,9 +68,7 @@ Rails.application.configure do # Prepend all log lines with the following tags. config.log_tags = [:request_id] - # "info" includes generic and useful information about system operation, but avoids logging too much - # information to avoid inadvertent exposure of personally identifiable information (PII). If you - # want to log everything, set the level to "debug". + # Change to "debug" to log everything (including potentially personally-identifiable information!) config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") # Use a different cache store in production. diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 727598011c..b344d4446e 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' } - # Set log level (default is :debug in Rails 4) - config.log_level = :info + # Change to "debug" to log everything (including potentially personally-identifiable information!) + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") # Configure logging: config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" }