Skip to content

Instantly share code, notes, and snippets.

@ilyadoroshin
Forked from eddanger/clean-rails-logs
Created April 27, 2016 11:08
Show Gist options
  • Select an option

  • Save ilyadoroshin/95553643a3b1529f349651fa5f07d1be to your computer and use it in GitHub Desktop.

Select an option

Save ilyadoroshin/95553643a3b1529f349651fa5f07d1be to your computer and use it in GitHub Desktop.
Rails Log Cleaner
#!/usr/bin/env ruby
logfiles = Dir["#{ENV['HOME']}/**/app/../log/*.log"] # any file with a .log extension in a log directory besides an app directory...
logfiles.each {|file| system "echo '' > #{file}"}
puts "Cleaned #{logfiles.size} logs..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment