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

Rails 5.0 silencer no longer compatible with logging gem #189

Open
lzap opened this issue Jan 22, 2018 · 0 comments
Open

Rails 5.0 silencer no longer compatible with logging gem #189

lzap opened this issue Jan 22, 2018 · 0 comments

Comments

@lzap
Copy link
Contributor

lzap commented Jan 22, 2018

Hey, this was pain to solve so this is a pro-active issue, perhaps we can mention this in the readme or something.

Rails devs refactored logger silencing code in 5.0 (rails/rails@2518bda) in a way that the code responsible for storing temporary level is now part of logger instead of silencer. This renders logging gem incompatible if silence method is overridden in Rails app leading to loosing level on concurrent silencing access, which happens all the time for us (for example sprockets gem silences logs, we have silencers in our code as well). After some time or immediately after start, level is reset to error level which makes development impossible (no debug messages).

While I share your opinion that silencing is bad and I think it comes from fact that Ruby/Rails both don't have trace level (more than debug, useful as opt-in development level when haunting bugs), I think this is worth mentioning somewhere in docs. Of course, if an app keeps using your RailsCompat module (#11) then there should be no problem, but pragmatic way of getting rid of too detailed logs is unfortunately to implement your own silence (until Rails adopts Logging gem :-)

For googlers, the obvious workaround is to store temporary levels in thread-local variables: theforeman/foreman#5197

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

1 participant