Skip to content

Instantly share code, notes, and snippets.

@crossle
Last active December 11, 2015 04:28
Show Gist options
  • Save crossle/4545409 to your computer and use it in GitHub Desktop.
Save crossle/4545409 to your computer and use it in GitHub Desktop.
Clear Rail log in development env only cp it to Rails.root/config/initializers/
if Rails.env.development?
MAX_LOG_SIZE = 10.megabytes
logs = [File.join(Rails.root, 'log', 'development.log'), File.join(Rails.root, 'log', 'test.log')]
logs.each do |log|
if File.size?(log).to_i > MAX_LOG_SIZE
$stdout.puts "Remove Log: #{log}"
`rm #{log}`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment