lograge icon indicating copy to clipboard operation
lograge copied to clipboard

Does lograge affect asset logging?

Open BattleBrisket opened this issue 7 years ago • 5 comments

Is there a way to leverage lograge to tame Rails' asset logging noise? I'm looking to completely eliminate everything after line 2.

Running Rails 5.1

(1.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
method=GET path=/login format=html controller=User::SessionsController action=new status=200 duration=1703.41 view=1430.82 db=3.84
10.0.2.2 - - [26/Apr/2018:18:08:16 UTC] "GET /login HTTP/1.1" 200 6013
- -> /login
10.0.2.2 - - [26/Apr/2018:18:08:18 UTC] "GET /assets/print-c4e414542d835ab311c84df841ed9069ae8cc114a522155d5c7100cc41bfc80f.css HTTP/1.1" 200 2660
http://localhost:3000/login -> /assets/print-c4e414542d835ab311c84df841ed9069ae8cc114a522155d5c7100cc41bfc80f.css
10.0.2.2 - - [26/Apr/2018:18:08:18 UTC] "GET /assets/modernizr-9a38f71010c2066e9d432ecc6261ffe763647aaea3d227b738133bd1d01e4655.js HTTP/1.1" 200 16084
http://localhost:3000/login -> /assets/modernizr-9a38f71010c2066e9d432ecc6261ffe763647aaea3d227b738133bd1d01e4655.js
10.0.2.2 - - [26/Apr/2018:18:08:18 UTC] "GET /assets/application-0851e5a7dcdc6daddc7a2da0464f1ae99e1df44bea22c54d51c53e6cbc6175ac.css HTTP/1.1" 200 591727
http://localhost:3000/login -> /assets/application-0851e5a7dcdc6daddc7a2da0464f1ae99e1df44bea22c54d51c53e6cbc6175ac.css
10.0.2.2 - - [26/Apr/2018:18:08:18 UTC] "GET /assets/application-faf7710ee79347227da023892b4f2885200537990a2e51851aaface1ac945d11.js HTTP/1.1" 200 1347797
http://localhost:3000/login -> /assets/application-faf7710ee79347227da023892b4f2885200537990a2e51851aaface1ac945d11.js
10.0.2.2 - - [26/Apr/2018:18:08:19 UTC] "GET /assets/glyphicons-regular.woff HTTP/1.1" 200 94644
http://localhost:3000/assets/application-0851e5a7dcdc6daddc7a2da0464f1ae99e1df44bea22c54d51c53e6cbc6175ac.css -> /assets/glyphicons-regular.woff

BattleBrisket avatar Apr 26 '18 18:04 BattleBrisket

This is essentially what lograge is made for. Please consult the readme for details.

pxlpnk avatar Apr 27 '18 04:04 pxlpnk

I did, which is why I was confused by the half results shown above. My output includes a consolidated lograge line for ActionView output, but assets are still being displayed. This is happening whether I place the config.lograge.enabled = true in config/application.rb or a specific environment (currently config/environments/development.rb for testing).

All the other switches look optional. My app has a default setup for controllers, and is not an API-only application. Am I missing something?

/edit: Rails 5.1.6 + lograge 0.10

BattleBrisket avatar Apr 27 '18 12:04 BattleBrisket

Alright, spent the last week digging through documentation and code for both Rails and lograge, and have yet to come up with anything definitive.

Can someone on the team confirm whether or not lograge would impact log output for assets? Again I'm looking to silence the request-response pairs that appear after line 1, demonstrated here:

method=GET path=/login format=html controller=User::SessionsController action=new status=200 duration=1703.41 view=1430.82 db=3.84
10.0.2.2 - - [26/Apr/2018:18:08:16 UTC] "GET /login HTTP/1.1" 200 6013
- -> /login
10.0.2.2 - - [26/Apr/2018:18:08:18 UTC] "GET /assets/print-c4e414542d835ab311c84df841ed9069ae8cc114a522155d5c7100cc41bfc80f.css HTTP/1.1" 200 2660
http://localhost:3000/login -> /assets/print-c4e414542d835ab311c84df841ed9069ae8cc114a522155d5c7100cc41bfc80f.css
10.0.2.2 - - [26/Apr/2018:18:08:18 UTC] "GET /assets/modernizr-9a38f71010c2066e9d432ecc6261ffe763647aaea3d227b738133bd1d01e4655.js HTTP/1.1" 200 16084
http://localhost:3000/login -> /assets/modernizr-9a38f71010c2066e9d432ecc6261ffe763647aaea3d227b738133bd1d01e4655.js
[ ... ]

BattleBrisket avatar May 02 '18 16:05 BattleBrisket

In what environment are you running lograge?

pxlpnk avatar May 25 '18 10:05 pxlpnk

I've replicated the behavior in development and production

BattleBrisket avatar Jun 05 '18 14:06 BattleBrisket