Created
April 11, 2018 20:54
-
-
Save betesh/c0624dfda982170ce45972b20c0b9e5b to your computer and use it in GitHub Desktop.
Logging Initializers in Rails 3.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in config/application.rb right before your Application class | |
class Rails::Initializable::Initializer | |
def run_with_logging(*args) | |
app = args.first | |
app.config.logger.warn "Running initializer #{name}\t(#{@context.class.parent})" | |
run_without_logging(*args) | |
end | |
alias_method_chain :run, :logging | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment