How do I get maximal logging while fixtures load? Or at least during the
tests?
I have added this to test/test_helper.rb :-
def logger
RAILS_DEFAULT_LOGGER.level = Logger::INFO
RAILS_DEFAULT_LOGGER
end
so that I can use logger.info("message") in my tests, This didn't
work, and neither did
# Replace this with your real tests.
# <FIXME>Leave this till other tests work</FIXME>
def test_truth
RAILS_DEFAULT_LOGGER.level = Logger::INFO
RAILS_DEFAULT_LOGGER.debug("studen_test.test_truth")
assert trueo
end
I still get nothing logged when this runs. I'm trying to debug my
fixtures which are setup with fixture_references, but I can't even
get logging to work here. I'm looking for entries in the log directory
where the {developer,test,server,production}.log files are, but nothing
ends up in those, even though they exist.
` Thank you,
Hugh
Rails turns off logging while the fixtures are loading. To get output
in the logs, you have to do a little hack of rails.
Firstly, it's probably best to do this in a frozen version of rails,
then you only affect your own app.
The edit needs to be done in vendor/rails/activerecord/lib/
active_record/fixtures.rb in the method self.create_fixtures(...).
Find the bit where it says
ActiveRecord::Base.silence do
....
end
and comment out the start and end lines of the block.
That should do the trick.
Rebecca
Rails turns off logging while the fixtures are loading. To get output
in the logs, you have to do a little hack of rails.
Firstly, it's probably best to do this in a frozen version of rails,
then you only affect your own app.
The edit needs to be done in vendor/rails/activerecord/lib/
active_record/fixtures.rb in the method self.create_fixtures(...).
Find the bit where it says
ActiveRecord::Base.silence do
....
end
and comment out the start and end lines of the block.
Thank you. I would never have found that without help.
That should do the trick.
Rebecca
Thank you,
Hugh