Edge Rails just got a new, buffered logger that will, apparently, make logging in Rails a little snappier.
This new logger is now the default, though you can change it back to the original logger in your environment.rb with:
config.logger = Logger.new('/path/to/log', Logger::DEBUG) |
Though I’m not sure why you’d want to do that…
tags: ruby, rubyonrails

You want to use the old logger because the BufferedLogger and the config.logger override seem to be broken at the moment. You can fix it by specifying:
RAILS_DEFAULT_LOGGER = Logger.new(File.join(RAILS_ROOT, ‘log’, ”#{RAILS_ENV}.log”))
Highly recommend sticking with the old Logger until submitted patches have been incorporated as this latest change by DHH breaks partial rendering (due to a benchmarking routine that calls logger.add(), a method missing from his new implementation). How that wasn’t discovered before he committed the changes I do not know.
You don’t see the logger problems with partials in tests because tests don’t use the BufferedLogger but either a mock, stub or default Ruby logger.
Obviously they didn’t run an application on this source before committing it, which is understandable.
Manfred – whilst I agree that unit tests wouldn’t pick this kind of thing up if the tests were (correctly) using a mocked or stubbed logger object, it only highlights the importance of having a good suite of functional/acceptance tests that will catch this sort of thing.
This was fixed and works now. That’s what you get for checking in late at night ;)