jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
318 stars 62 forks source link

Logs leaking to STDOUT when running specs #134

Open tagliala opened 2 years ago

tagliala commented 2 years ago

How to reproduce

  1. Clone the repo
  2. bundle
  3. rake
.I, [2021-11-02T09:37:11.575437 #82869]  INFO -- : Completed JSON API rendering (0.64ms)
.I, [2021-11-02T09:37:11.585741 #82869]  INFO -- : Completed JSON API rendering (0.33ms)
.I, [2021-11-02T09:37:11.596192 #82869]  INFO -- : Completed JSON API rendering (0.42ms)
.I, [2021-11-02T09:37:11.611554 #82869]  INFO -- : Completed JSON API rendering (0.36ms)
.I, [2021-11-02T09:37:11.636539 #82869]  INFO -- : Completed JSON API rendering (0.56ms)

This also happens when using jsonapi-rails in a rails application

ndbroadbent commented 2 years ago

Also discussed here: https://github.com/jsonapi-rb/jsonapi-rails/issues/116

I disabled the logs by adding this to spec/rails_helper.rb:

ActiveSupport.on_load(:action_controller) do
  ActiveSupport::Notifications.unsubscribe('parse.jsonapi-rails')
  ActiveSupport::Notifications.unsubscribe('render.jsonapi-rails')
end