【问题标题】:Passenger not logging Ruby STDOUT/STDERR?乘客没有记录 Ruby STDOUT/STDERR?
【发布时间】:2019-12-04 01:42:20
【问题描述】:

在我在过去 6 个月左右构建的服务器上,我注意到我无法让Passenger 记录任何Ruby 输出,也无法打印友好的错误页面,即使在指定passenger_friendly_error_pages on 时也是如此Nginx 配置文件的 HTTP 和服务器配置。

我使用的是用 Passenger 构建的 Nginx,其他一切都运行良好。当我遇到应用程序错误时,几乎不可能从生产环境中获得任何线索,因为没有错误日志、堆栈跟踪或任何东西,除了通常的“从服务器收到的不完整响应”,这是我在浏览器和在乘客日志中。

这是我的配置示例:

http {
    passenger_root /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-6.0.2;
    passenger_ruby /usr/local/rvm/gems/ruby-2.6.3/wrappers/ruby;
    passenger_log_level 2;
    passenger_max_pool_size 6;
    passenger_min_instances 2;
    passenger_pool_idle_time 60;
    passenger_spawn_method direct;
    passenger_friendly_error_pages on;
    passenger_log_file /opt/services/nginx-1.15.8/logs/passenger.log;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile      on;
    keepalive_timeout 120;
    client_max_body_size  200M;

    ...

    server {
        listen        443 ssl;
        server_name   app.domain.local;
        root /opt/production/app/public;
        passenger_enabled on;
        access_log logs/myapp.log;
        passenger_friendly_error_pages on;
        rack_env production;

        ssl_certificate            ssl/example.crt;
        ssl_certificate_key        ssl/example.key;

        location /scripts/ {
            expires 30d;
            add_header Pragma public;
            add_header Cache-Control "public";
        }
    }
}

有什么想法吗?

【问题讨论】:

    标签: passenger


    【解决方案1】:

    结果我不得不将passenger_log_level 设置为3。文档是这样说的:

    0 (crit): Show only critical errors which would cause Passenger to abort.
    1 (error): Also show non-critical errors – errors that do not cause Passenger to abort.
    2 (warn): Also show warnings. These are not errors, and Passenger continues to operate correctly, but they might be an indication that something is wrong with the system.
    3 (notice): Also show important informational messages. These give you a high-level overview of what Passenger is doing.
    4 (info): Also show less important informational messages. These messages show more details about what Passenger is doing. They're high-level enough to be readable by users.
    5 (debug): Also show the most important debugging information. Reading this information requires some system or programming knowledge, but the information shown is typically high-level enough to be understood by experienced system administrators.
    6 (debug2): Show more debugging information. This is typically only useful for developers.
    7 (debug3): Show even more debugging information.
    

    人们会假设任何由 Ruby 写入 STDERR 的内容至少会被视为警告(日志级别 2)。奇怪的行为。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    • 2018-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多