You can overload call method from Formatter.
example:
class Logger
class Formatter
Format = "%s [%s] %s %sn"
def call(severity, time, progname, msg)
Format % [severity, format_datetime(time), progname, msg]
end
end
end
$LOG.error('This is much shorter.')
# ERROR [2006-03-31T19:35:01.058646 ] This is much shorter.
2010/3/22 Tom Mac <[email protected]>:
> Hi
> I would like to know how I can customize logger message format in
> rails 2.3.5
>
> Thanks in advance
> Tom
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.