------ art_10749_17155573.1152737073310 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline > > > I'm writing an application that uses both Ruby's Logger and > > ActiveRecord, but ActiveRecord seems to break Ruby's Logger, as > > the Logger data (date, level, etc...) is not output anymore. > > Hi George > > Rails' ActiveSupport overrides the Logger#format_message method. To > get back to the normal log formatting, you can use something like this > in you script. > > class Logger > private > > # Rails overrides this method so that it can customize the format > # of it's logs. > def format_message(*args) > old_format_message(*args) > end > end > > Nick, Funny, I was just having this same problem with Logger and ActiveRecord. I can't seem to get your solution to work. This script: require 'logger' require 'rubygems' require_gem 'activerecord' class Logger private # Rails overrides this method so that it can customize the format # of it's logs. def format_message(*args) old_format_message(*args) end end log ogger.new(STDERR) log.info("Hello!") Throws this error: /home/neilk/bin/loggertest.rb:14:in `format_message': undefined method `old_format_message' for #<Logger:0x489cc8> (NoMethodError) from /ropt/local/lib/ruby/1.8/logger.rb:320:in `add' from /ropt/local/lib/ruby/1.8/logger.rb:372:in `info' from /home/neilk/bin/loggertest.rb:21 What am I missing? -- Neil Kohl nakohl / gmail.com ------ art_10749_17155573.1152737073310--