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: fix broken 'airbrake:deploy' #1003

Merged
merged 1 commit into from Aug 15, 2019
Merged

Conversation

kyrylo
Copy link
Contributor

@kyrylo kyrylo commented Aug 15, 2019

The new suggested way to configure logger in Rails apps was added in pull
request #986. Unfortunately, there's an issue with it. We load the initialiser
on bundle exec rake airbrake:deploy and at this time Rails.logger is not
defined yet. Therefore, the deploys would fail in 100% of cases because of
NoMethodError.

To work around this issue we simply check for the existence of Rails.logger.
This change is simple. However, what I don't like is that we leak a lot of our
code to the user space. The users have to study how we setup logging. For the
sake of simplicity we want to avoid that and keep the config simple.

To achieve that, Airbrake::Rails.logger was added. It hides all the complexity
from the users. Probably the best part is that if users stumble upon another bug
in the logging setup, they won't need to update how the config works. Right now,
because of this bug, they have to touch their config again and this is an
oversight on my part.

@kyrylo kyrylo force-pushed the rails-logger-fix-for-deploys branch from ff31555 to 4f92fc8 Compare August 15, 2019 06:48
The new suggested way to configure logger in Rails apps was added in pull
request #986. Unfortunately, there's an issue with it. We load the initialiser
on `bundle exec rake airbrake:deploy` and at this time `Rails.logger` is not
defined yet. Therefore, the deploys would fail in 100% of cases because of
NoMethodError.

To work around this issue we simply check for the existence of `Rails.logger`.
This change is simple. However, what I don't like is that we leak a lot of *our*
code to the user space. The users have to study how we setup logging. For the
sake of simplicity we want to avoid that and keep the config simple.

To achieve that, `Airbrake::Rails.logger` was added. It hides all the complexity
from the users. Probably the best part is that if users stumble upon another bug
in the logging setup, they won't need to update how the config works. Right now,
because of this bug, they have to touch their config again and this is an
oversight on my part.
@kyrylo kyrylo force-pushed the rails-logger-fix-for-deploys branch from 4f92fc8 to 7c78284 Compare August 15, 2019 09:10
@kyrylo kyrylo merged commit 58bd5e0 into master Aug 15, 2019
@kyrylo kyrylo deleted the rails-logger-fix-for-deploys branch August 15, 2019 09:30
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

1 participant