Skip to content

Instantly share code, notes, and snippets.

@ericbeland
Created February 23, 2011 12:24
Show Gist options
  • Save ericbeland/840370 to your computer and use it in GitHub Desktop.
Save ericbeland/840370 to your computer and use it in GitHub Desktop.
Log all calls to require in Ruby
# Logs calls to require so if a required file is blowing up, you can
# see the last require and diagnose. If your app stops booting, can be handy to
# find what borked things.
require 'logger'
class Object
def require(file_name)
log = Logger.new(File.join(File.dirname(__FILE__), 'required.log'))
log.debug("requiring: #{file_name}")
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment