Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails console log - how to customize what is printed in the console

When I run rails s it loads up and everything works. When I browse to a page several lines of information are printed. Mostly this is the webpage getting the assets for the page. I really don't need to see this and have it clutter my screen. Is there a way to customize what gets printed in console?

Thanks

like image 859
recursive_acronym Avatar asked Sep 26 '11 17:09

recursive_acronym


3 Answers

For assets pipeline messages it seems that you can't (yet). See How to disable logging of asset pipeline (sprockets) messages in Rails 3.1? and the rails issue on Github

You can do it in part by using these lines (credits) in your development.rb file

config.after_initialize do |app|
  app.assets.logger = Logger.new('/dev/null')
end
like image 158
Fabio Avatar answered Nov 15 '22 05:11

Fabio


For Rails 3.1, inside config/environments/development.rb, set the following to false:

config.assets.debug = false

Your logs will show you everything you want to see minus the assets.

like image 26
Jeff Devine Avatar answered Nov 15 '22 05:11

Jeff Devine


You can configure the logging detail of the rails dev server by setting config.log_level in environments/development.rb. Setting it to :warn will get rid of most of the logging (you can always send your own messages with whatever log level you want so they still get printed).

http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels

http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels

like image 20
spike Avatar answered Nov 15 '22 04:11

spike