From 5dfd5bb2df091f96859f37b08bbf15a4488aaf6e Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Wed, 15 Jan 2025 10:02:29 +0000 Subject: [PATCH 1/2] Update crontab log level Set to "warn" or else "info" messages will be emailed when jobs run to the address defined as `MAILTO`. This started happening in Rails 7.1. See: #8090 Fixes #8532 --- config/crontab-example | 1 + 1 file changed, 1 insertion(+) diff --git a/config/crontab-example b/config/crontab-example index f86314758b..023333c417 100644 --- a/config/crontab-example +++ b/config/crontab-example @@ -11,6 +11,7 @@ PATH=/home/<%= user %>/.gem/ruby/<%= ruby_version %>/bin:/usr/local/bin:/usr/bin <% end %> MAILTO=<%= mailto %> +RAILS_LOG_LEVEL=warn # Every 5 minutes */5 * * * * <%= user %> <%= vhost_dir %>/<%= vcspath %>/commonlib/bin/run-with-lockfile.sh -n <%= vhost_dir %>/change-xapian-database.lock "<%= vhost_dir %>/<%= vcspath %>/script/update-xapian-index verbose=true" >> <%= vhost_dir %>/<%= vcspath %>/log/update-xapian-index.log || echo "stalled?" From 546e6a75a1744d60906a21367a874c05839e65f5 Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Wed, 15 Jan 2025 10:04:42 +0000 Subject: [PATCH 2/2] Update log level environment variable Rails production environment uses `RAILS_LOG_LEVEL` lets be consistent with other environments. --- config/environments/development.rb | 6 +++--- config/environments/staging.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 0fff5f0a6e..eb8f886266 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -81,9 +81,9 @@ Rails.root.join('spec', 'mailers', 'previews') ] - # Set LOG_LEVEL in the environment to a valid log level to temporarily run the - # application with a non-default setting. - config.log_level = ENV.fetch('LOG_LEVEL', :debug) + # Set RAILS_LOG_LEVEL in the environment to a valid log level to temporarily + # run the application with a non-default setting. + config.log_level = ENV.fetch('RAILS_LOG_LEVEL', :debug) # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 0dc6200fa5..63b2c7bee0 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -8,9 +8,9 @@ # Use a different logger for distributed setups # config.logger = SyslogLogger.new - # Set LOG_LEVEL in the environment to a valid log level to temporarily run the - # application with a non-default setting. - config.log_level = ENV.fetch('LOG_LEVEL', :info) + # Set RAILS_LOG_LEVEL in the environment to a valid log level to temporarily + # run the application with a non-default setting. + config.log_level = ENV.fetch('RAILS_LOG_LEVEL', :info) # Full error reports are disabled and caching is turned on config.action_controller.consider_all_requests_local = false