# Lame logger timestamp question

**URL:** <https://www.ruby-forum.com/t/lame-logger-timestamp-question/149887>\
**Category:** Rails\
**Created:** [September 30, 2008, 9:11pm UTC](https://www.ruby-forum.com/t/lame-logger-timestamp-question/149887 "2008-09-30T21:11:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [September 30, 2008, 9:11pm UTC](https://www.ruby-forum.com/t/lame-logger-timestamp-question/149887/1 "2008-09-30T21:11:51Z")

</div>

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](http://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging)  
i am recommended to use…  
class Logger  
def format\_message(severity, timestamp, progname, msg)  
if !@formatter.nil?  
@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?
