From: Jamis Buck Date: 2005-10-06T05:35:46+09:00 Subject: Re: Ruby 1.8.3 breaks Needle's logger? On Oct 5, 2005, at 2:27 PM, Daniel Berger wrote: > Jamis Buck wrote: > >> On Oct 5, 2005, at 9:14 AM, Berger, Daniel wrote: >> >>> The problem was a hard coded "Format" constant in the Logger >>> class that >>> defined the format. This was bad, but not fatal. The >>> ActiveRecord/Nitro/Needle/Glue, etc, folks made it worse when, >>> instead >>> of subclassing, they redefined the Logger class and did things like >>> 'remove_const "Format"', among other questionable decisions. I'm >>> not >>> sure who wrote that code first but it was, unfortunately, copied and >>> used by several authors. >>> >> *Ahem*. For what it's worth, Needle *does* subclass Logger. ;) >> And subclassing is no protection against a change in an internal >> API. >> - Jamis >> > > Well, this is darn strange then: > > djberge@~/local/src/ruby/needle-1.2.1/test-580>/opt/bin/ruby -v ALL- > TESTS.rb > ruby 1.8.3 (2005-05-12) [sparc-solaris2.10] > Loaded suite ALL-TESTS > Started > ...................................................................... > ...................................................................... > ............................. > Finished in 2.039164 seconds. > > 169 tests, 350 assertions, 0 failures, 0 errors > > Yet, with 1.8.2 I see 4 test failures out of tc_logger.rb (which I > just reported on the RubyForge project page). Hmmm: chuckles:~/Projects/needle/trunk> ruby -v test/ALL-TESTS.rb ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0.0] Loaded suite test/ALL-TESTS Started ........................................................................ ........................................................................ ........................... Finished in 0.967888 seconds. 171 tests, 352 assertions, 0 failures, 0 errors Maybe I need to package another Needle release...but I don't think trunk has anything that hasn't been released yet. I haven't worked on Needle in ages. Could also be a problem with Ruby on solaris... not having a solaris box to test on, there's no way for me to test that. As for the clean bill of slate on 1.8.3, blame my incomplete coverage of logger, probably. I haven't yet tried 1.8.3 (being a rails-for-my- meat-and-potatoes guy). However, unless things are miraculously watching over Needle's code, I suspect the logs it generates will be malformed...but that's just a guess based on what I've seen of the changes in 1.8.3's logger. > > Also, why "Logger < ::Logger" ? Ah, but don't leave out the context: module Needle class Logger << ::Logger end end Needle::Logger is a subclass of the global ::Logger. - Jamis > > Regards, > > Dan Cheers, Jamis