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

Silence asset requests with config.assets.quiet #355

Merged
merged 1 commit into from
Jun 9, 2016

Conversation

kmcphillips
Copy link
Contributor

@rafaelfranca @josh

Builds on and finishes what @route started in #338.

Basically a deprecation of the quiet_assets gem.

Adds the config.assets.quiet option. Defaulted to false in all cases. When true, it loads a middleware. That middleware looks at the asset prefix path, and if matches will wrap the given request in a logger.silence { } call.

I've added to the README but I don't know if/where I should document it further.

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rafaelfranca
Copy link
Member

Looks great. It seems the sprockets 4 tests are not passing. I guess it is because the tests you defined needs to point to a manifest file. Could you take a look?

@kmcphillips
Copy link
Contributor Author

Build fixed. 💚

@sonalkr132
Copy link

Can we have version release please 💙

dzaporozhets pushed a commit to gitlabhq/gitlabhq that referenced this pull request Jul 4, 2016
quiet_assets has been seemingly abandoned, and now sprockets-rails has the feature built-in!

From this PR: rails/sprockets-rails#355
dzaporozhets pushed a commit to gitlabhq/gitlabhq that referenced this pull request Jul 4, 2016
Upgrade sprockets and sprockets rails, remove quiet_assets

## What does this MR do?

Upgrade Sprockets from 3.6.0 to 3.6.2.

Changelog: https://github.com/rails/sprockets/blob/3.x/CHANGELOG.md

Upgrade Sprockets Rails from 3.0.4 to 3.1.1.

Changelog: rails/sprockets-rails@v3.0.4...v3.1.1

quiet_assets has been seemingly abandoned, and now sprockets-rails has the feature built-in!

The config was added in this PR: rails/sprockets-rails#355

Working towards #14286.

See merge request !5029
gabebw added a commit to hotline-webring/hotline-webring that referenced this pull request Jul 8, 2016
We were using Rails 5.0.0.rc1.

* Instead of the `quiet_assets` gem, set `config.assets.quiet = true`: rails/sprockets-rails#355
* Remove `coffee-rails`, which wasn't being used
@neohunter
Copy link

Using sprocket-rails 3.2.0 I'm still getting thinks like:

Started GET "/assets/img/icon/status2x.png" for ::1 at 2017-02-24 05:44:18 -0500
Started GET "/assets/plugins/jquery-datatable/images/sort_asc.png" for ::1 at 2017-02-24 05:44:19 -0500

This should be removed also? or this is from the webserver (thin)?

@BattleBrisket
Copy link

BattleBrisket commented May 2, 2018

According to my testing, the integration of the quiet_assets gem only applies to asset logs, and not the request logs for said assets.

In Rails 5, with config.assets.quiet = true, you still get plenty of asset output.

Started GET "/login" for 10.0.2.2 at 2018-05-02 18:49:29 +0000
Processing by User::SessionsController#new as HTML
  Rendering users/sessions/new.html.haml within layouts/application
  Rendered layouts/_magic_submit_button.html.haml (2.4ms)
  Rendered users/shared/_links.haml (1.7ms)
  Rendered users/sessions/new.html.haml within layouts/application (880.7ms)
  Rendered partials/_footer.html.haml (7.5ms)
  Rendered /home.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/paloma-5.1.0/app/views/paloma/_hook.html.erb (0.4ms)
  Rendered layouts/_backbone_templates.html.haml (4.9ms)
  Rendered partials/_build_comment.html.haml (1.0ms)
Completed 200 OK in 1349ms (Views: 1138.9ms | ActiveRecord: 3.1ms)


10.0.2.2 - - [02/May/2018:18:49:29 UTC] "GET /login HTTP/1.1" 200 6211
- -> /login
10.0.2.2 - - [02/May/2018:18:49:31 UTC] "GET /assets/print-c4e414542d835ab311c84df841ed9069ae8cc114a522155d5c7100cc41bfc80f.css HTTP/1.1" 200 2660
http://localhost:3000/login -> /assets/print-c4e414542d835ab311c84df841ed9069ae8cc114a522155d5c7100cc41bfc80f.css
10.0.2.2 - - [02/May/2018:18:49:31 UTC] "GET /assets/modernizr-9a38f71010c2066e9d432ecc6261ffe763647aaea3d227b738133bd1d01e4655.js HTTP/1.1" 200 16084
http://localhost:3000/login -> /assets/modernizr-9a38f71010c2066e9d432ecc6261ffe763647aaea3d227b738133bd1d01e4655.js
10.0.2.2 - - [02/May/2018:18:49:31 UTC] "GET /assets/glyphicons-regular.woff HTTP/1.1" 200 94644
http://localhost:3000/assets/application-0851e5a7dcdc6daddc7a2da0464f1ae99e1df44bea22c54d51c53e6cbc6175ac.css -> /assets/glyphicons-regular.woff
10.0.2.2 - - [02/May/2018:18:49:31 UTC] "GET /favicon.ico HTTP/1.1" 200 0
- -> /favicon.ico

I understand that the team has repeatedly stated that they will not disable these logs, I am just looking for a way to silence them in my own environments, and older solutions do not seem to work in the 5.x line.

Can anyone provide some direction as to how I might eliminate the request log lines -- everything after Completed 200 OK in 1349ms (Views: 1138.9ms | ActiveRecord: 3.1ms) -- in Rails 5?

@Pysis868
Copy link

For these other messages, I found through the middleware stack that they are produced by WEBrick as access log messages. I was finally able to quiet them using this Rails Server init config boot.rb method: rails/rails#28968 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants