Skip to content
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
Closed

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

rafamvc opened this issue Aug 22, 2011 · 177 comments

Comments

@rafamvc
Copy link

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
Copy link

istvanp commented Sep 2, 2011

Bump x9+ (see question @ stackoverflow)

@chrismealy
Copy link

+1

@m4tm4t
Copy link

m4tm4t commented Sep 6, 2011

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

@elland
Copy link

elland commented Sep 6, 2011

+1

5 similar comments
@aneziocampos
Copy link

+1

@luizfonseca
Copy link

+1

@raonibr
Copy link

raonibr commented Sep 6, 2011

+1

@tycooon
Copy link
Contributor

tycooon commented Sep 7, 2011

+1

@justindell
Copy link

+1

@bhavinkamani
Copy link
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..

@istvanp
Copy link

istvanp commented Sep 10, 2011

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

@celsodantas
Copy link

+1

1 similar comment
@triendeau
Copy link

+1

@rafamvc
Copy link
Author

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
Copy link
Contributor

+1

@guilleiguaran
Copy link
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

@gferraz
Copy link

gferraz commented Sep 19, 2011

+1

1 similar comment
@tmeasday
Copy link

+1

@whatcould
Copy link

(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
Copy link

+1

1 similar comment
@hiphapis
Copy link

+1

@shadowbq
Copy link

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
Copy link

sars commented Oct 1, 2011

+1

2 similar comments
@karlfreeman
Copy link
Contributor

+1

@evgenyneu
Copy link

+1

@m4tm4t
Copy link

m4tm4t commented Oct 10, 2011

@shadowbq thank you, work very well

@ffissore
Copy link

+1

2 similar comments
@et
Copy link

et commented Oct 13, 2011

+1

@atambo
Copy link
Contributor

atambo commented Oct 13, 2011

+1

@mperham
Copy link
Contributor

mperham commented Oct 13, 2011

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

@unimatrixZxero
Copy link

+1

@ndbroadbent
Copy link
Contributor

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

gem 'disable_assets_logger', :group => :development

@ghost
Copy link

ghost commented Jan 26, 2013

+1

@rubytastic
Copy link

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

Inside initializer

@clickworkorange
Copy link

+1

@clickworkorange
Copy link

@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
Copy link

👍

1 similar comment
@findrails
Copy link

+1

@ghost
Copy link

ghost commented Apr 27, 2013

still on, bitchez

@ghost
Copy link

ghost commented Apr 27, 2013

hate to check production logfile with

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

@p-originate
Copy link

So when is this getting fixed in a usable way?

@TinNT
Copy link

TinNT commented May 14, 2013

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

@ghost
Copy link

ghost commented May 30, 2013

seriously. rails 4 beta and this still a bug.

#fml

@ozdigennaro
Copy link

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

@tinderfields
Copy link

+1

2 similar comments
@earlonrails
Copy link

👍

@DavideMiozzi
Copy link

+1

@ozdigennaro
Copy link

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
Copy link

+1

2 similar comments
@lexigen
Copy link

lexigen commented Oct 30, 2013

+1

@victormartins
Copy link

+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
Copy link

+1

1 similar comment
@philipp-spiess
Copy link

👍

antw added a commit to quintel/etflex that referenced this issue Feb 25, 2014
@iloveitaly
Copy link
Contributor

👍

1 similar comment
@deeTEEcee
Copy link

+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.
Projects
None yet
Development

No branches or pull requests