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

Projects
None yet
6 participants
@kmcphillips
Contributor

kmcphillips commented Jun 9, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Jun 9, 2016

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.

rails-bot commented Jun 9, 2016

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

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Jun 9, 2016

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?

Member

rafaelfranca commented Jun 9, 2016

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

This comment has been minimized.

Show comment
Hide comment
@kmcphillips

kmcphillips Jun 9, 2016

Contributor

Build fixed. 💚

Contributor

kmcphillips commented Jun 9, 2016

Build fixed. 💚

@rafaelfranca rafaelfranca merged commit 7fa2b4d into rails:master Jun 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@sonalkr132

This comment has been minimized.

Show comment
Hide comment
@sonalkr132

sonalkr132 Jun 25, 2016

Can we have version release please 💙

sonalkr132 commented Jun 25, 2016

Can we have version release please 💙

@sonalkr132 sonalkr132 referenced this pull request Jun 25, 2016

Closed

Rails 5 update #1341

dzaporozhets pushed a commit to gitlabhq/gitlabhq that referenced this pull request Jul 4, 2016

Remove quiet_assets in favor of built-in sprockets-rails config.
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

Merge branch 'upgrade-sprockets-rails' into 'master'
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 gabebw/hotline-webring that referenced this pull request Jul 8, 2016

Use Rails 5.0.0
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

@gabebw gabebw referenced this pull request Jul 8, 2016

Merged

Use Rails 5.0.0 #50

@shlok007 shlok007 referenced this pull request Aug 9, 2016

Closed

Upgrade to Rails 5.0 #1130

@neohunter

This comment has been minimized.

Show comment
Hide comment
@neohunter

neohunter Feb 24, 2017

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)?

neohunter commented Feb 24, 2017

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)?

@tonytonyjan tonytonyjan referenced this pull request Jun 5, 2017

Closed

Rails 5.1 support #55

@jwright jwright referenced this pull request Jul 20, 2017

Merged

2765 papertrail #3496

3 of 3 tasks complete
@BattleBrisket

This comment has been minimized.

Show comment
Hide comment
@BattleBrisket

BattleBrisket 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?

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?

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