So in rails 2.1 the standard method for overriding log file format has changed? no longer can i class Logger def format_message(severity, timestamp, progname, msg) "#{timestamp} #{severity} #{msg}\n" end end
instead from this site http://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging i am recommended to use... class Logger def format_message(severity, timestamp, progname, msg) if <a href="mailto:!@formatter.nil">!@formatter.nil</a>? @formatter.call(severity, timestamp, progname, msg) else @default_formatter.call(severity, timestamp, progname, msg) end end end
class RailsFormatter < Logger::Formatter def call(severity, timestamp, progname, msg) "#{msg}\n" end end
RAILS_DEFAULT_LOGGER.formatter = RailsFormatter.new
but that just throws up a syntax error on the if statement and then the last line.
All i really need is time stamps in rails 2.1, and there seems to be some conflict about the best method to do that, any suggestions?