Hi, in unicorn.conf.rb I want to log a welcome message (current datetime
basically) to the error log, so I do:
if Process.ppid == 1 || Process.getpgrp != $$
stderr_path "/tmp/error.log"
$stderr.puts "#{Time.now} Starting..."
Unfortunatelly the message is displayed in the terminal rather than the file.
However with the following hacks the message is displayed in the file:
a)
stderr_path "/tmp/error.log"
$stderr.reopen "/tmp/error.log"
$stderr.puts "#{Time.now} Starting..."
b)
stderr_path "/tmp/error.log"
File.open("/tmp/error.log", 'ab') { |fp| $stderr.reopen(fp) }
$stderr.puts "#{Time.now} Starting..."
The second workaround is exactly what Unicorn does when calling to
"stderr_path" ("redirect_io" method). So, why doesn't work for me without the
hacks? do I miss something?
Thanks a lot.
--
Iñaki Baz Castillo <[email protected]>
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying