You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
362 B
Ruby
12 lines
362 B
Ruby
# Rotates development and test log files when they exceed 20 MB.
|
|
# In production use a more robust system like /etc/logrotate.d/.
|
|
#
|
|
if Rails.env.development? || Rails.env.test?
|
|
log_file = Rails.root.join("log", "#{Rails.env}.log")
|
|
|
|
if log_file.file? && log_file.size > 5_000_000
|
|
FileUtils.cp(log_file, "#{log_file}.1")
|
|
log_file.truncate(0)
|
|
end
|
|
end
|