Recently I worked on a project where the Rails logs were filling up way too quickly. Even though we had log rotation implemented, disk space was filling up fast. As a short term solution, we wanted to suppress all SQL logging Rails. Here's what I did.
#place this in environment.rb class ActiveRecord::ConnectionAdapters::OracleAdapter def log_info(sql, name, runtime) end end
What, you thought it would be difficult? This particular code works for Oracle; for MySQL just change the class to extend ActiveRecord::ConnectionAdapters::MysqlAdapter. For good measure, here's how I rotate logs in Rails:
#place this in environment.rb
Rails::Initializer.run do |config|
config.logger = Logger.new("/path/to/logs/#{RAILS_ENV}.log", 5, 10485760)
end
This will rotate the logs up to 5 times, each file being about 10 megs in size.
Related posts:
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.