繁体   English   中英

在生产模式下运行 rails app 不会在终端中显示生产服务器日志。 并显示错误浏览器出现问题

[英]running rails app in production mode is not displaying the production server logs in terminal. and showing the error something went wrong in browser

当我在开发模式下运行 rails 应用程序时,服务器日志正确显示在终端中。 但是当我在生产模式下运行应用程序时,服务器没有在终端中显示任何服务器日志。 并且浏览器中显示错误,例如“我们很抱歉,但出了点问题。”我正在使用以下命令运行服务器。我正在使用瘦服务器。

rails s -e production

这是我在启动服务器时进入服务器模式的输出。在此之后,当我提出任何请求时,没有显示任何输出。

prashant@prashant-pc:~/client_proj/template$ rails s -e production
=> Booting Thin
=> Rails 4.1.5 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

什么可能是我没有得到的问题。

production.rb你可以添加这个选项: config.logger = Logger.new(STDOUT)

如果你在production.rb看到这个块

  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

那么你可以简单地设置环境变量与任何价值export开始的前rails server

$ export RAILS_LOG_TO_STDOUT=true

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM