문제

I have a rails app with a lot of information in the seed process. Is there a way to set it so that it logs to one of the log files?

도움이 되었습니까?

해결책

If your just running your seeds with the rake db:seed task you could do:

$ rake db:seed --trace

다른 팁

Rails.logger.debug("Message") will go to the log/development.log file.

You can do this in console tail -f log/development.log to see it in action.

Try

say_with_time("Doing this and that") do
  # seed stuff
end

to make your seeds more verbose, and redirect to a file via '> log'. I suppose you could hijack the logger at init time and use a file-logger instead, if you don't like the '> log' solution.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top