RailsCasts Pro episodes are now free!
Learn more or hide this
There is a newer version of this episode, see the revised episode.
Resources
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') require 'logger' RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) end
def show @cart = current_cart logger.debug "Hello world! #{@cart.to_yaml}" # debug, info, warn, error, fatal end
Rails::Initializer.run do |config| config.active_record.colorize_logging = false end class Logger def format_message(level, time, progname, msg) "#{time.to_s(:db)} #{level} -- #{msg}\n" end end
config.log_level = :debug config.logger = Logger.new(...) # or log4r