Rails开发日志

时间:2011-02-05 19:24:13

标签: ruby-on-rails console logging tail

我在RoR教程的第6章中,似乎无法使命令'tail -f log / development.log'起作用。使用Mac OS X 10.6.6,Ruby 1.9.2,Rails 3.0.3和RVM。我正试图在一个sanboxed Rails控制台中运行它,这是正在发生的事情的输出:

Trenton-Scotts-MacBook-Air:sample_app TTS$ rails c --sandbox
Loading development environment in sandbox (Rails 3.0.3)
Any modifications you make will be rolled back on exit
ruby-1.9.2-p136 :001 > tail -f log/development.log
SyntaxError: (irb):1: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
tail -f log/development.log
           ^
    from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
    from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
    from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
ruby-1.9.2-p136 :002 > 

有什么想法吗?

3 个答案:

答案 0 :(得分:8)

Tail不是Ruby命令。您应该直接在终端中运行它:

$ tail -f logs/development.log
#=> output
#=> ctrl+c
$ rails c --sandbox

答案 1 :(得分:4)

你在irb控制台内。从irb控制台退出并在你的shell中试用

答案 2 :(得分:3)

tail是一个UNIX命令。您需要先退出ruby控制台,然后在shell中执行它 或者你可以简单地打开另一个shell窗口。