I’m using passenger and seeing that stdout & stderr are going to nginx’s
default error log, rather than what’s specified in the server {
error_log … } directive. Is this a known bug in nginx or passenger?
server {
listen 8082;
access_log logs/ruby-access.log main;
error_log logs/ruby-error.log; ## nothing in here from ruby's
$std{out,err}!
root /Users/paulm/Code/nginx/public;
location / {
passenger_enabled on;
}
}
Here’s all the code & config; it’s a trivial Sinatra server:
app.rb
require 'sinatra'
get '/' do
$stderr.puts "stderr"
$stdout.puts "stdout"
'got /'
end
config.ru
require 'sinatra'
require 'app.rb'
run Sinatra::Application
nginx.conf
worker_processes 1;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /Library/Ruby/Gems/1.8/gems/passenger-3.0.11;
passenger_ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby;
This file has been truncated. show original
Phusion Passenger from here: Install — Phusion Passenger™ (a.k.a. mod_rails / mod_rack) (seems
to install nginx 1.0.10)
(The workaround is to File#reopen in config.ru but I’d like to avoid
this, if possible.)
Many thanks!
Paul
Posted at Nginx Forum:
I can confirm this.
nginx version: nginx/1.0.12
Phusion Passenger version 3.0.11
In my case, I have error_log defined at all three levels, as described
here:
Separating Error Logs per Virtual Host | NGINX
Posted at Nginx Forum:
When reopening $stderr in “a” (append) mode, the file is not written to.
However, when reopening with “w” (write) mode, things work as expected.
Also, since I have the server error log set to debug, reopening $stderr
also results in other messages being written. For example, info
messages.
Posted at Nginx Forum: