Skip to content

Instantly share code, notes, and snippets.

@krisleech
Created October 4, 2018 15:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save krisleech/e5e79b4e059740dceefa5b8dc20263c1 to your computer and use it in GitHub Desktop.
Why no backtrace? (Rails 5.1.6)

Backtrace lines from engines outside of Rails root or GEM_PATH, i.e. referenced with path in Gemfile are stripped from the backtrace:

Rails.backtrace_cleaner.clean(["#{Rails.root}/lib/foo, '/home/me/dev/otherproject/lib/foo'])
# => ['<rails_root>/lib/foo']


Rails.backtrace_cleaner.remove_silencers!
Rails::BacktraceCleaner::APP_DIRS_PATTERN.match?('/lib') # => true
Rails::BacktraceCleaner::APP_DIRS_PATTERN.match?('lib') # => true
Rails::BacktraceCleaner::APP_DIRS_PATTERN.match?('something lib') # => false
Rails::BacktraceCleaner::APP_DIRS_PATTERN.match?('something /lib') # => false
Rails::BacktraceCleaner::APP_DIRS_PATTERN.match?('asdasdasd') # => false
  • ActiveSupport::Logger.silencer is set to false to disable the ability to silence logging in a block. The default is true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment