问题
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 &
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>):
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 &
But the problem still exists.
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".
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
Thanks a lot:)
回答1:
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 &
来源:https://stackoverflow.com/questions/32449040/puma-production-server-in-background-omniauth-logging-to-stdout-failed-cause-er