AR and Logger

I posted a minor rave in ruby-talk about the intrussiveness of AR with
the Logger implementation.
The original describes how I use a Formatter to get the desired message
format and how it all goes awry when I require AR.

It has been very annoying (to the point of considering dropping AR
altogether).
I finally found the culprit (it’s in active_support/clean_logger.rb):

alias old_format_message format_message

Ruby 1.8.3 transposed the msg and progname arguments to

format_message.

We can’t test RUBY_VERSION because some distributions don’t keep Ruby

and its standard library in sync, leading to installations of Ruby

1.8.2

with Logger from 1.8.3 and vice versa.

if method_defined?(:formatter=)
def format_message(severity, timestamp, progname, msg)
“#{msg}\n”
end
else
def format_message(severity, timestamp, msg, progname)
“#{msg}\n”
end
end

Now, apart from the reservation I have about hacking a base library like
Logger, I also wonder why would one overwrite the newer (1.8.3)
format_message implementation although Logger now allows for a format
definition.

Why not use the following:
if !method_defined?(:formatter=)
def format_message(severity, timestamp, progname, msg)
“#{msg}\n”
end
end

Then create an ActiveRecordFormatter

class ActiveRecordFormatter<Logger::Formatter
def call severity, time, progname, msg
“#{msg}\n”
end
end

and assign this as the default_formatter for Logger.

This is a lot less intrusive for the >1.8.3 implementations than what we
have at the moment.
Cheers,
V.-

Vassilis R. wrote:

I posted a minor rave in ruby-talk about the intrussiveness of AR with
the Logger implementation.
[snip]

and assign this as the default_formatter for Logger.

This is a lot less intrusive for the >1.8.3 implementations than what we
have at the moment.
Ok, I found the ticket http://dev.rubyonrails.org/ticket/7106 with the
fix I want, and it has been commited 3 months ago but did not make it
into activesupport 1.4.2.

Any chance for a 1.4.3 release?
Cheers,
V.-