Simplify the way to set the maximum log size

We can use the new configuration option in Rails 7.1, so we don't have
to configure it manually.
This commit is contained in:
Javi Martín
2024-04-15 15:05:46 +02:00
parent 5db773e44f
commit a1ae4651ff
3 changed files with 3 additions and 15 deletions

View File

@@ -76,12 +76,6 @@ Rails.application.configure do
config.eager_load_paths << "#{Rails.root}/spec/mailers/previews"
config.action_mailer.preview_paths << "#{Rails.root}/spec/mailers/previews"
# Limit size of local logs
# TODO: replace with config.log_file_size after upgrading to Rails 7.1
logger = ActiveSupport::Logger.new(config.default_log_file, 1, 100.megabytes)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

View File

@@ -67,12 +67,6 @@ Rails.application.configure do
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Limit size of local logs
# TODO: replace with config.log_file_size after upgrading to Rails 7.1
logger = ActiveSupport::Logger.new(config.default_log_file, 1, 100.megabytes)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
# Raise error when a before_action's only/except options reference missing actions
# config.action_controller.raise_on_missing_callback_actions = true

View File

@@ -149,9 +149,9 @@ Rails.application.config.active_support.use_message_serializer_for_metadata = tr
# `config.load_defaults 7.1` does not set this value for environments other than
# development and test.
#++
# if Rails.env.local?
# Rails.application.config.log_file_size = 100 * 1024 * 1024
# end
if Rails.env.local?
Rails.application.config.log_file_size = 100 * 1024 * 1024
end
###
# Enable raising on assignment to attr_readonly attributes. The previous