Skip to content

Instantly share code, notes, and snippets.

@betesh
Created April 11, 2018 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betesh/c0624dfda982170ce45972b20c0b9e5b to your computer and use it in GitHub Desktop.
Save betesh/c0624dfda982170ce45972b20c0b9e5b to your computer and use it in GitHub Desktop.
Logging Initializers in Rails 3.2
# 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