puts vs logger in rails rake tasks

后端 未结 8 1530
情书的邮戳
情书的邮戳 2021-01-30 06:24

In a rake task if I use puts command then I see the output on console. However I will not see that message in log file when app is deployed on production.

However if I s

8条回答
  •  孤城傲影
    2021-01-30 06:30

    Execute a background job with '&' and open script/console or whatever.. That way you can run multiple commands in the same window.

    tail -f log/development.log &
    script/console
    Loading development environment (Rails 2.3.5)
    >> Product.all
    2011-03-10 11:56:00 18062 DEBUG  Product Load (6.0ms)  SELECT * FROM "products"
    [,]
    

    note Can get sloppy quickly when there is a lot of logging output.

提交回复
热议问题