rails: fix broken 'airbrake:deploy' #1003
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 timeRails.logger
is notdefined 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 complexityfrom 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.