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

Prevent exception on Rails startup #487

Closed

Conversation

zspencer
Copy link

@zspencer zspencer commented Feb 17, 2024

I'm not entirely sure if this is the "right" way to fix this (in fact, I'm pretty sure it's not...)
I'm presuming that setting the ReplayLogger#level to log the most things will ensure it doesn't drop messages.

I noticed on a project that since the 3.0 release of dotenv-rails, the application would fail to start due to the ReplayLogger responding to #level as if it were a command to log a statement, rather than a query to determine the level the Logger is configured for.

You can see the exception here: https://github.com/zinc-collective/convene/actions/runs/7923719579/job/21633994956?pr=2210

The application in question is a Rails 7.1 app, running Ruby 3.2.

I'm not entirely sure if this is the "right" way to fix this (in fact,
I'm pretty sure it's not...)

But I noticed on a project that since the 3.0 release of `dotenv-rails`,
the application would fail to start due to the `ReplayLogger` responding
to `#level` as if it were a command to log a statement, rather than a
query to determine the level the `Logger` is configured for.

You can see the exception here: https://github.com/zinc-collective/convene/actions/runs/7923719579/job/21633994956?pr=2210
@multiplegeorges
Copy link

multiplegeorges commented Feb 22, 2024

We were getting this and we tracked it down to a gem version issue.

We had (for various old reasons) gem "rails", "= 7.1.0". Once we loosened that up to gem "rails", "~> 7.1.0" it properly upgraded our dependencies and this issue went away.

@zspencer YMMV but that worked for us.

@bkeepers
Copy link
Owner

Thanks for taking time to work on this. I took an alternate approach in #492 and just made ReplayLogger extend Logger so it has all the functionality of a real logger.

@bkeepers bkeepers closed this Feb 26, 2024
@zspencer
Copy link
Author

That sounds much wiser than my attempt! Thank you!

@zspencer zspencer deleted the level-isnt-a-log-statement branch February 26, 2024 22:07
@zspencer zspencer restored the level-isnt-a-log-statement branch February 26, 2024 22:07
@zspencer zspencer deleted the level-isnt-a-log-statement branch February 26, 2024 22:07
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

3 participants