【问题标题】:Puma / missing logs彪马 / 丢失原木
【发布时间】:2014-03-12 09:51:57
【问题描述】:

为什么我在日志中看不到任何 Rails 特定条目?

我在普通的 Debian 机器上使用 Puma 2.7.1 和 Nginx 代理,没什么特别的,通过 RVM 使用 ruby​​ 1.9.3。

我的 puma 配置:

#!/usr/bin/env puma
environment 'sandbox'
bind 'unix://tmp/puma.sock'
stdout_redirect 'log/puma.log', 'log/puma_error.log', true
pidfile 'tmp/pids/puma.pid'
state_path 'tmp/pids/puma.state'
daemonize true 
workers 4

我通过以下方式启动 puma:

bundle exec puma -C config/puma/config.rb

我明白了:

[23664] Puma starting in cluster mode...
[23664] * Version 2.7.1, codename: Earl of Sandwich Partition
[23664] * Min threads: 0, max threads: 16
[23664] * Environment: sandbox
[23664] * Process workers: 4
[23664] * Phased restart available
[23664] * Listening on unix://tmp/puma.sock
[23664] * Daemonizing...

我跑:

tail -f log/puma*

我明白了:

==> log/puma_error.log <==
X-Accel-Mapping header missing
=== puma startup: 2014-02-13 14:08:52 +0100 ===
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

==> log/puma.log <==
=== puma startup: 2014-02-13 14:08:52 +0100 ===
[23670] - Worker 23678 booted, phase: 0
[23670] - Worker 23674 booted, phase: 0
[23670] - Worker 23686 booted, phase: 0
[23670] - Worker 23682 booted, phase: 0

但我没有看到更多日志,没有任何与应用程序相关的内容。

当应用程序引发异常时,我在日志中一无所获...“tabula rasa”

【问题讨论】:

    标签: ruby-on-rails ruby nginx puma


    【解决方案1】:

    Rails 有一个单独的日志文件,不会记录到 puma 日志中。默认情况下,Rails 记录到logs/&lt;environment&gt;.log 中的文件,例如log/production.log

    【讨论】:

    • 哈哈,是的,当然是你的权利......我的大脑在度假 :) 由于 Syslog 配置,我错过了日志。谢谢
    • 嗨,@astropanic 说的是对的。不过,我并不完全同意他的看法。如果我查看我的 development.log,我可以看到 Rails 日志,但看不到 stdout 日志,例如,我看不到代码中的 puts 消息。也许是因为我没有任何错误,但我也看不到错误。我想念这些 stdout 和 stderr 文件(例如在 Unicorn 中)。
    • 我看不到 @Holger 提到的特定于 env 的日志文件。我正在使用 nginx 和 puma 作为 rails
    • 有没有办法让 puma 显示 rails 日志?也许环境配置中有一些东西?
    • @FactorMystic 您可以将 Rails 配置为登录到 STDOUT,然后将在 puma 日志中结束。但是,这可能会产生其他副作用,例如来自并发请求的混合日志块...
    猜你喜欢
    • 1970-01-01
    • 2015-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-20
    • 2021-01-27
    相关资源
    最近更新 更多