本文介绍了在后台运行puma生产服务器:omniauth记录到stdout失败导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Rails + PUMA作为生产服务器.我使用httpd设置虚拟机并将请求转发到localhost:3000.我用来启动puma服务器的命令是(已经在app文件夹内)

I am using rails + puma as my production server. I used httpd to set up virtual machine and forward request to localhost:3000. And the command I used to start up my puma server is(inside the app folder already)

puma -e production -p 3000 &

当我仍然使用ssh登录服务器时,我的Web应用程序的所有设置都很好.只是一些日志实际上出现在屏幕上(我没有注意).但是,当我退出ssh会话时.我不能使用omniauth(a gem).我查看了服务器日志:

Everything with my web app is fine when I was still logged in the server with ssh. only that some logs actually appears on the screen(I did not pay attention to it). However, when I exited the ssh session. I cannot use omniauth(a gem). I looked inside the server log:

Errno::EIO (Input/output error @ io_write - <STDERR>):

我在网上寻找了这个问题-这是一个IO连接问题,在我的情况下,原因应该是产生了puma的父进程已经完成,但是puma尝试将某些内容记录到该进程中.

I looked for this online--it is a IO connection issue and the cause in my case should be that the parent process that spawned puma is done but puma tried to log something to it.

所以我使用了重定向,并希望控制台能够正常工作:

So I used redirection and hope that console would be fine:

puma -e production -p 3000 > log/console.log &

但是问题仍然存在.

到目前为止,我认为它仅与omniauth有关:即使我执行了此操作,它也始终会记录到stdout" https://github.com/intridea/omniauth/issues/583 ".

So far I think it is only related to omniauth: it always logs to stdout even if I did this "https://github.com/intridea/omniauth/issues/583".

所以现在我想我可以尝试更改omniauth的记录器,也可以尝试将标准输出"更改为omniauth,即使它在后台运行也是如此

So for now I guess I can either try to change logger of omniauth or try to "give a stdout" to omniauth even if it is running in background

非常感谢:)

推荐答案

证明该日志记录是用于警告,并记录到stderr而不是stdout中.所以我通过以下命令解决了这个问题

turns out that the logging is for warning and logged to stderr instead of stdout. so I solved this issue by the following command

puma -e production -p 3000 1> log/console.log 2>console_err.log &

这篇关于在后台运行puma生产服务器:omniauth记录到stdout失败导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 22:10