Skip to content

Commit

Permalink
limit log size in production
Browse files Browse the repository at this point in the history
Limit the production log to 50MB. If a larger log size is desired then
the environment variable `RAILS_LOG_SIZE` can be set.
  • Loading branch information
zfletch committed Nov 5, 2019
1 parent e4146be commit 58f704e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
else
size = (ENV['RAILS_LOG_SIZE'].presence || 50).to_i
config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 1, size * 1024 * 1024)
end

# Do not dump schema after migrations.
Expand Down

0 comments on commit 58f704e

Please sign in to comment.