Skip to content

Instantly share code, notes, and snippets.

@JonnieCache
Created July 31, 2010 09:19
Show Gist options
  • Select an option

  • Save JonnieCache/501977 to your computer and use it in GitHub Desktop.

Select an option

Save JonnieCache/501977 to your computer and use it in GitHub Desktop.
# Add rails logging to script/console like in script/server
# to disable it for one run do this command:
#
# RAILS_CONSOLE_LOGGING=off script/console
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') && !%w{false off}.include?(ENV['RAILS_CONSOLE_LOGGING'])
require 'logger'
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment