【问题标题】:Rails Development LogRails 开发日志
【发布时间】:2011-06-22 00:00:13
【问题描述】:

我在 RoR 教程的第 6 章,似乎无法让命令“tail -f log/development.log”工作。使用带有 RVM 的 Mac OS X 10.6.6、Ruby 1.9.2、Rails 3.0.3。我正在尝试在一个 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 > 

有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails console logging tail


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      您在 irb 控制台中。从 irb 控制台退出并在你的 shell 中尝试

      【讨论】:

        【解决方案3】:

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

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

        【讨论】:

        猜你喜欢
        • 2010-11-04
        • 2015-05-27
        • 2012-03-23
        • 1970-01-01
        • 2013-06-04
        • 2011-09-13
        • 1970-01-01
        • 1970-01-01
        • 2021-04-26
        相关资源
        最近更新 更多