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

Update to use correct LoggerSilencer in ActiveSupport 6 #33

Closed
wants to merge 1 commit into from

Conversation

hasghari
Copy link

@hasghari hasghari commented Sep 17, 2019

I don't know what the policy of this gem is regarding supporting older ruby versions but given that ruby has officially dropped support for 2.3, I've removed the unsupported versions from the Travis CI build.

@schneems
Copy link
Contributor

You should probably not be using this gem with Rails 6. Rails generates files config that you can use to output logs to stdout with an env var now. I would recommend using that config.

@hasghari
Copy link
Author

You should probably not be using this gem with Rails 6. Rails generates files config that you can use to output logs to stdout with an env var now. I would recommend using that config.

Thanks.

@hasghari hasghari closed this Sep 30, 2019
@hasghari
Copy link
Author

hasghari commented Oct 1, 2019

@schneems This gem doesn't work as expected in Rails 6 because Rails will always override the logger level and set it to config.log_level, regardless of whether we have set up a custom logger.
https://github.com/rails/rails/blob/ee10e05af27facf42b1c49f8aaa0463d3af6989c/railties/lib/rails/application/bootstrap.rb#L53

It will be helpful to update the dependencies to reflect the incompatibility with Rails 6.

@hasghari
Copy link
Author

hasghari commented Oct 1, 2019

In case any one else runs into this for Rails 6, this is how I updated my config/application.rb to replace this gem:

config.log_level = ENV.fetch('LOG_LEVEL', 'INFO').downcase

if ENV['RAILS_LOG_TO_STDOUT'].present?
  logger           = ActiveSupport::Logger.new(STDOUT)
  logger.level     = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
  config.logger    = ActiveSupport::TaggedLogging.new(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

Successfully merging this pull request may close these issues.

None yet

2 participants