New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Served asset log messages are pretty annoying! :) #2639

Closed
rafamvc opened this Issue Aug 22, 2011 · 177 comments

Comments

Projects
None yet
@rafamvc

rafamvc commented Aug 22, 2011

Is there a setup to disable them?
I tried

config.assets.logger = nil

but no luck.

 GET "/assets/application.css" for 127.0.0.1 at 2011-08-22 11:19:59 -0700
Served asset /application.css - 304 Not Modified (1ms)
@istvanp

This comment has been minimized.

Show comment
Hide comment
@istvanp

istvanp commented Sep 2, 2011

Bump x9+ (see question @ stackoverflow)

@chrismealy

This comment has been minimized.

Show comment
Hide comment
@chrismealy

chrismealy commented Sep 3, 2011

+1

@m4tm4t

This comment has been minimized.

Show comment
Hide comment
@m4tm4t

m4tm4t Sep 6, 2011

+1, this log takes up too much space in my terminal (~100 lines per request !)

m4tm4t commented Sep 6, 2011

+1, this log takes up too much space in my terminal (~100 lines per request !)

@Elland

This comment has been minimized.

Show comment
Hide comment
@Elland

Elland commented Sep 6, 2011

+1

@aneziocampos

This comment has been minimized.

Show comment
Hide comment

aneziocampos commented Sep 6, 2011

+1

@luizfonseca

This comment has been minimized.

Show comment
Hide comment
@luizfonseca

luizfonseca commented Sep 6, 2011

+1

@raonibr

This comment has been minimized.

Show comment
Hide comment
@raonibr

raonibr commented Sep 6, 2011

+1

@tycooon

This comment has been minimized.

Show comment
Hide comment
@tycooon

tycooon Sep 7, 2011

Contributor

+1

Contributor

tycooon commented Sep 7, 2011

+1

@justindell

This comment has been minimized.

Show comment
Hide comment
@justindell

justindell commented Sep 7, 2011

+1

@bhavinkamani

This comment has been minimized.

Show comment
Hide comment
@bhavinkamani

bhavinkamani Sep 9, 2011

Contributor

+1. There should be a way to control this or configure asset logger like we do with active_record, action_controller etc. Is it using Rails.logger?. Overriding Rails.logger is apparently not having any impact on "Served asset" calls. Swaping Rails::Rack::Logger too didn't help..

Contributor

bhavinkamani commented Sep 9, 2011

+1. There should be a way to control this or configure asset logger like we do with active_record, action_controller etc. Is it using Rails.logger?. Overriding Rails.logger is apparently not having any impact on "Served asset" calls. Swaping Rails::Rack::Logger too didn't help..

@istvanp

This comment has been minimized.

Show comment
Hide comment
@istvanp

istvanp Sep 10, 2011

I use tail -f log/development.log | grep -vE "(^\s*$|asset)" until this gets fixed...

istvanp commented Sep 10, 2011

I use tail -f log/development.log | grep -vE "(^\s*$|asset)" until this gets fixed...

@celsodantas

This comment has been minimized.

Show comment
Hide comment

celsodantas commented Sep 11, 2011

+1

@triendeau

This comment has been minimized.

Show comment
Hide comment
@triendeau

triendeau commented Sep 12, 2011

+1

@rafamvc

This comment has been minimized.

Show comment
Hide comment
@rafamvc

rafamvc Sep 12, 2011

That is +12 so far... I unfortunately can't code this myself, so if any one wants to make a patch... :D

rafamvc commented Sep 12, 2011

That is +12 so far... I unfortunately can't code this myself, so if any one wants to make a patch... :D

@fedesoria

This comment has been minimized.

Show comment
Hide comment
@fedesoria

fedesoria Sep 16, 2011

Contributor

+1

Contributor

fedesoria commented Sep 16, 2011

+1

@guilleiguaran

This comment has been minimized.

Show comment
Hide comment
@guilleiguaran

guilleiguaran Sep 16, 2011

Member
GET "/assets/application.css" for 127.0.0.1 at 2011-08-22 11:19:59 -0700
Served asset /application.css - 304 Not Modified (1ms)

The first line is logged by Rails, the second one by Sprockets. You can shut up Sprockets logging:

Rails.application.assets.logger = Logger.new '/dev/null'

Sorry but you couldn't do same for the first line

Member

guilleiguaran commented Sep 16, 2011

GET "/assets/application.css" for 127.0.0.1 at 2011-08-22 11:19:59 -0700
Served asset /application.css - 304 Not Modified (1ms)

The first line is logged by Rails, the second one by Sprockets. You can shut up Sprockets logging:

Rails.application.assets.logger = Logger.new '/dev/null'

Sorry but you couldn't do same for the first line

@gferraz

This comment has been minimized.

Show comment
Hide comment
@gferraz

gferraz commented Sep 19, 2011

+1

@tmeasday

This comment has been minimized.

Show comment
Hide comment
@tmeasday

tmeasday commented Sep 19, 2011

+1

@whatcould

This comment has been minimized.

Show comment
Hide comment
@whatcould

whatcould Sep 21, 2011

(specific instructions for suggeston from @guilleiguaran):

Just put this in your environment file (eg development.rb) to disable the sprockets log:

  config.after_initialize do |app|
    app.assets.logger = Logger.new('/dev/null')
  end

whatcould commented Sep 21, 2011

(specific instructions for suggeston from @guilleiguaran):

Just put this in your environment file (eg development.rb) to disable the sprockets log:

  config.after_initialize do |app|
    app.assets.logger = Logger.new('/dev/null')
  end
@kaluznyo

This comment has been minimized.

Show comment
Hide comment
@kaluznyo

kaluznyo commented Sep 21, 2011

+1

@hiphapis

This comment has been minimized.

Show comment
Hide comment
@hiphapis

hiphapis commented Sep 26, 2011

+1

@shadowbq

This comment has been minimized.

Show comment
Hide comment
@shadowbq

shadowbq Sep 30, 2011

3.1 (only) (3.2 breaks before_dipatch)
app\config\initializers\quiet_assets.rb

Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
  def before_dispatch_with_quiet_assets(env)
    before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0
  end
  alias_method_chain :before_dispatch, :quiet_assets
end

3.2 Rails - Rack root tap approach
app\config\initializers\quiet_assets.rb

Rails.application.assets.logger = Logger.new('/dev/null') 
Rails::Rack::Logger.class_eval do 
  def call_with_quiet_assets(env)
    previous_level = Rails.logger.level
    Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 
    call_without_quiet_assets(env).tap do
      Rails.logger.level = previous_level
    end 
  end 
  alias_method_chain :call, :quiet_assets 
end 

(So much thanks to for the answer and code 'choonkeat'
Reference: http://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1
Learn more about tap in Ruby 1.9: http://ruby-doc.org/core/Object.html

shadowbq commented Sep 30, 2011

3.1 (only) (3.2 breaks before_dipatch)
app\config\initializers\quiet_assets.rb

Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
  def before_dispatch_with_quiet_assets(env)
    before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0
  end
  alias_method_chain :before_dispatch, :quiet_assets
end

3.2 Rails - Rack root tap approach
app\config\initializers\quiet_assets.rb

Rails.application.assets.logger = Logger.new('/dev/null') 
Rails::Rack::Logger.class_eval do 
  def call_with_quiet_assets(env)
    previous_level = Rails.logger.level
    Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 
    call_without_quiet_assets(env).tap do
      Rails.logger.level = previous_level
    end 
  end 
  alias_method_chain :call, :quiet_assets 
end 

(So much thanks to for the answer and code 'choonkeat'
Reference: http://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1
Learn more about tap in Ruby 1.9: http://ruby-doc.org/core/Object.html

@sars

This comment has been minimized.

Show comment
Hide comment
@sars

sars commented Oct 1, 2011

+1

@karlfreeman

This comment has been minimized.

Show comment
Hide comment
@karlfreeman

karlfreeman Oct 3, 2011

Contributor

+1

Contributor

karlfreeman commented Oct 3, 2011

+1

@evgenyneu

This comment has been minimized.

Show comment
Hide comment
@evgenyneu

evgenyneu commented Oct 10, 2011

+1

@m4tm4t

This comment has been minimized.

Show comment
Hide comment
@m4tm4t

m4tm4t Oct 10, 2011

@shadowbq thank you, work very well

m4tm4t commented Oct 10, 2011

@shadowbq thank you, work very well

@ffissore

This comment has been minimized.

Show comment
Hide comment
@ffissore

ffissore commented Oct 13, 2011

+1

@et

This comment has been minimized.

Show comment
Hide comment
@et

et commented Oct 13, 2011

+1

@atambo

This comment has been minimized.

Show comment
Hide comment
@atambo

atambo Oct 13, 2011

Contributor

+1

Contributor

atambo commented Oct 13, 2011

+1

@mperham

This comment has been minimized.

Show comment
Hide comment
@mperham

mperham Oct 13, 2011

Contributor

This is hugely annoying to us too. It would be nice to see some movement on this issue.

Contributor

mperham commented Oct 13, 2011

This is hugely annoying to us too. It would be nice to see some movement on this issue.

@auxout

This comment has been minimized.

Show comment
Hide comment
@auxout

auxout commented Oct 15, 2011

+1

@erlingur

This comment has been minimized.

Show comment
Hide comment
@erlingur

erlingur commented Oct 17, 2011

+1

@ckdake

This comment has been minimized.

Show comment
Hide comment
@ckdake

ckdake commented Oct 17, 2011

+1

@carlosramireziii

This comment has been minimized.

Show comment
Hide comment
@carlosramireziii
Contributor

carlosramireziii commented Oct 17, 2011

+1

@danieltdt

This comment has been minimized.

Show comment
Hide comment
@danieltdt

danieltdt commented Oct 17, 2011

+1

@andrusha

This comment has been minimized.

Show comment
Hide comment
@andrusha

andrusha Oct 18, 2011

+1, what the heck is this "+1" thing? is it to make finding useful comments really hard?

andrusha commented Oct 18, 2011

+1, what the heck is this "+1" thing? is it to make finding useful comments really hard?

@istvanp

This comment has been minimized.

Show comment
Hide comment
@istvanp

istvanp Oct 19, 2011

@andrusha For the lack of the ability to upvote/prioritize issues, +1 basically means "me too."

istvanp commented Oct 19, 2011

@andrusha For the lack of the ability to upvote/prioritize issues, +1 basically means "me too."

@scottopherson

This comment has been minimized.

Show comment
Hide comment

scottopherson commented Oct 19, 2011

+1

@chipchiq

This comment has been minimized.

Show comment
Hide comment
@chipchiq

chipchiq commented Oct 20, 2011

+1

@kennyj

This comment has been minimized.

Show comment
Hide comment
@kennyj

kennyj Oct 20, 2011

Contributor

+1

Contributor

kennyj commented Oct 20, 2011

+1

@jdxcode

This comment has been minimized.

Show comment
Hide comment
@jdxcode

jdxcode Oct 24, 2012

Contributor

+1

Contributor

jdxcode commented Oct 24, 2012

+1

@gamafranco

This comment has been minimized.

Show comment
Hide comment
@gamafranco

gamafranco commented Oct 25, 2012

+1

@pmontrasio

This comment has been minimized.

Show comment
Hide comment
@pmontrasio

pmontrasio Oct 28, 2012

I put macournoyer's code in an initializer, followed by the line by choonkeat.
That made most all the log entries disappear with the exception of these messages:

WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

There is a thread in stackoverflow about that, here.

I followed their suggestions and removed those messages by adding gem "webrick", "1.3.1" to the group :development block of Gemfile. My rails output is readable now.

pmontrasio commented Oct 28, 2012

I put macournoyer's code in an initializer, followed by the line by choonkeat.
That made most all the log entries disappear with the exception of these messages:

WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

There is a thread in stackoverflow about that, here.

I followed their suggestions and removed those messages by adding gem "webrick", "1.3.1" to the group :development block of Gemfile. My rails output is readable now.

@darthdeus

This comment has been minimized.

Show comment
Hide comment
@darthdeus

darthdeus commented Nov 3, 2012

+1

@flunder

This comment has been minimized.

Show comment
Hide comment
@flunder

flunder Nov 6, 2012

config.assets.debug = false
config.assets.logger = nil

Neither works for moi :/

flunder commented Nov 6, 2012

config.assets.debug = false
config.assets.logger = nil

Neither works for moi :/

@Omnipresent

This comment has been minimized.

Show comment
Hide comment
@Omnipresent

Omnipresent Nov 22, 2012

n00b question. Where should DisableAssetsLogger be placed? in initializer?

Omnipresent commented Nov 22, 2012

n00b question. Where should DisableAssetsLogger be placed? in initializer?

@flunder

This comment has been minimized.

Show comment
Hide comment
@flunder

flunder Nov 22, 2012

Exactly! Create a file in initialisers and it should work!

------*

On 22 Nov 2012, at 22:26, Bhaarat Sharma notifications@github.com wrote:

n00b question. Where should DisableAssetsLogger be placed? in initializer?


Reply to this email directly or view it on GitHub.

flunder commented Nov 22, 2012

Exactly! Create a file in initialisers and it should work!

------*

On 22 Nov 2012, at 22:26, Bhaarat Sharma notifications@github.com wrote:

n00b question. Where should DisableAssetsLogger be placed? in initializer?


Reply to this email directly or view it on GitHub.

@flunder

This comment has been minimized.

Show comment
Hide comment
@flunder

flunder Nov 23, 2012

Oh wait if its just the one-liner than that goes in your environment! If that doesn't work you'll need to go for the workaround via the initialisers as far as I can see

------*

On 22 Nov 2012, at 22:26, Bhaarat Sharma notifications@github.com wrote:

n00b question. Where should DisableAssetsLogger be placed? in initializer?


Reply to this email directly or view it on GitHub.

flunder commented Nov 23, 2012

Oh wait if its just the one-liner than that goes in your environment! If that doesn't work you'll need to go for the workaround via the initialisers as far as I can see

------*

On 22 Nov 2012, at 22:26, Bhaarat Sharma notifications@github.com wrote:

n00b question. Where should DisableAssetsLogger be placed? in initializer?


Reply to this email directly or view it on GitHub.

@djmaze

This comment has been minimized.

Show comment
Hide comment
@djmaze

djmaze commented Dec 5, 2012

+1

@unimatrixZxero

This comment has been minimized.

Show comment
Hide comment

unimatrixZxero commented Dec 5, 2012

+1

@ndbroadbent

This comment has been minimized.

Show comment
Hide comment
@ndbroadbent

ndbroadbent Dec 11, 2012

Contributor

Hi @Omnipresent, I've just released this as a gem, so you can add it your Gemfile:

gem 'disable_assets_logger', :group => :development
Contributor

ndbroadbent commented Dec 11, 2012

Hi @Omnipresent, I've just released this as a gem, so you can add it your Gemfile:

gem 'disable_assets_logger', :group => :development
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost commented Jan 26, 2013

+1

@rubytastic

This comment has been minimized.

Show comment
Hide comment
@rubytastic

rubytastic Jan 31, 2013

if Rails.env.development?
ActiveRecord::Base.logger = Logger.new('/dev/null')
end

Inside initializer

rubytastic commented Jan 31, 2013

if Rails.env.development?
ActiveRecord::Base.logger = Logger.new('/dev/null')
end

Inside initializer

@clickworkorange

This comment has been minimized.

Show comment
Hide comment

clickworkorange commented Feb 8, 2013

+1

@clickworkorange

This comment has been minimized.

Show comment
Hide comment
@clickworkorange

clickworkorange Feb 8, 2013

@rafamvc (and others): My sprockets railtie (v3.2.11) checks

if config.assets.logger != false

Setting config.assets.logger to false - not nil - in development.rb got rid of the spam.

clickworkorange commented Feb 8, 2013

@rafamvc (and others): My sprockets railtie (v3.2.11) checks

if config.assets.logger != false

Setting config.assets.logger to false - not nil - in development.rb got rid of the spam.

@jaredbrown

This comment has been minimized.

Show comment
Hide comment
@jaredbrown

jaredbrown commented Apr 8, 2013

👍

@findrails

This comment has been minimized.

Show comment
Hide comment
@findrails

findrails commented Apr 8, 2013

+1

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 27, 2013

still on, bitchez

ghost commented Apr 27, 2013

still on, bitchez

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 27, 2013

hate to check production logfile with

 tail -f log/production.log  -n 1000 | grep -v asset

ghost commented Apr 27, 2013

hate to check production logfile with

 tail -f log/production.log  -n 1000 | grep -v asset
@p-originate

This comment has been minimized.

Show comment
Hide comment
@p-originate

p-originate May 6, 2013

So when is this getting fixed in a usable way?

p-originate commented May 6, 2013

So when is this getting fixed in a usable way?

@TinNT

This comment has been minimized.

Show comment
Hide comment
@TinNT

TinNT May 14, 2013

tail -f log/development.log | grep -vE "(^$|asset)"

TinNT commented May 14, 2013

tail -f log/development.log | grep -vE "(^$|asset)"

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 30, 2013

seriously. rails 4 beta and this still a bug.

#fml

ghost commented May 30, 2013

seriously. rails 4 beta and this still a bug.

#fml

@ozdigennaro

This comment has been minimized.

Show comment
Hide comment
@ozdigennaro

ozdigennaro May 31, 2013

I love it when someone else does the work. The 'nbroadbent' gem worked fine for me. rails 3.2.13.

ozdigennaro commented May 31, 2013

I love it when someone else does the work. The 'nbroadbent' gem worked fine for me. rails 3.2.13.

@tinderfields

This comment has been minimized.

Show comment
Hide comment

tinderfields commented Jul 5, 2013

+1

@earlonrails

This comment has been minimized.

Show comment
Hide comment
@earlonrails

earlonrails commented Aug 7, 2013

👍

@DavideMiozzi

This comment has been minimized.

Show comment
Hide comment

DavideMiozzi commented Aug 24, 2013

+1

@ozdigennaro

This comment has been minimized.

Show comment
Hide comment
@ozdigennaro

ozdigennaro Aug 24, 2013

They certainly are.
Oz

On 08/24/2013 06:16 AM, Davide Miozzi wrote:

+1


Reply to this email directly or view it on GitHub
#2639 (comment).

ozdigennaro commented Aug 24, 2013

They certainly are.
Oz

On 08/24/2013 06:16 AM, Davide Miozzi wrote:

+1


Reply to this email directly or view it on GitHub
#2639 (comment).

@acasajus

This comment has been minimized.

Show comment
Hide comment
@acasajus

acasajus commented Oct 27, 2013

+1

@lexigen

This comment has been minimized.

Show comment
Hide comment
@lexigen

lexigen commented Oct 30, 2013

+1

@victormartins

This comment has been minimized.

Show comment
Hide comment

victormartins commented Dec 16, 2013

+1

antw added a commit to quintel/etflex that referenced this issue Dec 16, 2013

antw added a commit to quintel/etflex that referenced this issue Dec 17, 2013

@AndrewBelt

This comment has been minimized.

Show comment
Hide comment
@AndrewBelt

AndrewBelt commented Feb 16, 2014

+1

@philipp-spiess

This comment has been minimized.

Show comment
Hide comment

philipp-spiess commented Feb 24, 2014

👍

antw added a commit to quintel/etflex that referenced this issue Feb 25, 2014

@0xdevalias 0xdevalias referenced this issue Jun 3, 2014

Closed

Web log spam #365

@iloveitaly

This comment has been minimized.

Show comment
Hide comment
@iloveitaly

iloveitaly commented Mar 20, 2015

👍

@deeTEEcee

This comment has been minimized.

Show comment
Hide comment
@deeTEEcee

deeTEEcee commented Apr 5, 2015

+1

@rails rails locked and limited conversation to collaborators Apr 5, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.