Skip to content

Instantly share code, notes, and snippets.

@flanker
Last active July 24, 2018 07:27
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 flanker/c24af4bae7159593ac5b3ae32efce06a to your computer and use it in GitHub Desktop.
Save flanker/c24af4bae7159593ac5b3ae32efce06a to your computer and use it in GitHub Desktop.
Show Mongoid and Active Record logs in Rails console
Mongoid.logger.level = Logger::DEBUG
Mongo::Logger.logger.level = Logger::DEBUG
ActiveRecord::Base.logger = Logger.new(STDOUT)
Mongoid.logger = Logger.new(STDOUT)
Mongo::Logger.logger = Logger.new(STDOUT)
# limit of mongoid log truncated
Mongo::Monitoring::CommandLogSubscriber::LOG_STRING_LIMIT = 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment