Tuesday, February 4, 2014

Solution to turn off Rails asset pipeline log in Rails 4 development log file

While working on one of the application created in Rails4, I was annoyed by the way Rails asset was writing in application log file, debugging was turning out to be bit difficult. Here is how the log was looking like:

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/facebook32x32.png" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/youtube32x32.png" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/googleplus.png" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/twitter-old.png" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/linkedin32x32.png" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/banner5.jpeg" for 127.0.0.1 at 2014-02-04 20:20:53 +0530
[2014-02-04 20:20:53] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Here is the solution which I implemented to turn off assets pipeline log:

I added 'quiet_assets' gem in Gemfile and then run bundle install:
gem 'quiet_assets', :group => :development 
To re-enable the logging of the asset pipeline messages, place the following in yourconfig/application.rb file:
config.quiet_assets = false 

No comments:

Post a Comment