Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide rendering of partials from rails logs

Tags:

I believe the default behavior of rails logging on production is to not output the rendering of all partials. This should log in development but not on production.

However, I'm seeing this in production and I'm not sure how to remove it. My logs are too noisy. My production environment is Heroku running Unicorn and using Papertrail to view my logs. I know Unicorn does some wonky stuff with logs and to get them working properly in the first place I had to add this to my production.rb:

  config.logger = Logger.new(STDOUT)   config.logger.level = Logger.const_get('INFO') 

( Explained here: http://help.papertrailapp.com/kb/configuration/unicorn )

But even with log_level INFO I'm seeing huge blocks of these in all my logs:

Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.7ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (2.1ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (4.8ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.3ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (0.4ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (4.4ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.3ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (0.3ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (1.8ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.4ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (4.6ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (2.1ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.3ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (0.4ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (4.1ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.2ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (1.8ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (6.0ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.5ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (0.8ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_category.html.erb (1.9ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_caption.html.erb (0.3ms)  Jun 25 22:15:15 tacktile app/web.1:    Rendered photos/pieces/_rights.html.erb (0.7ms)  
like image 414
Keith Schacht Avatar asked Jun 26 '13 05:06

Keith Schacht


1 Answers

For Rails 4 (at least):

Try this in your config/environments/development.rb

config.action_view.logger = nil 
like image 173
Patrice Gagnon Avatar answered Nov 01 '22 07:11

Patrice Gagnon