Skip to content

Logs leaking to STDOUT when running specs #134

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

Open
tagliala opened this issue Nov 2, 2021 · 2 comments
Open

Logs leaking to STDOUT when running specs #134

tagliala opened this issue Nov 2, 2021 · 2 comments

Comments

@tagliala
Copy link
Contributor

tagliala commented Nov 2, 2021

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

Also discussed here: #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

@tagliala
Copy link
Contributor Author

This does not happen when setting the logger as Rails.logger, which is surprisingly not the same by default

# frozen_string_literal: true

JSONAPI::Rails.configure do |config|
  config.logger = Rails.logger
end

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

No branches or pull requests

2 participants