stderr_path doesn't work at the moment of being called

Iñaki Baz Castillo ibc at
Tue Jan 5 05:26:32 EST 2010

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 "#{} 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:

  stderr_path "/tmp/error.log"
  $stderr.reopen "/tmp/error.log"
  $stderr.puts "#{} Starting..."

  stderr_path "/tmp/error.log""/tmp/error.log", 'ab') { |fp| $stderr.reopen(fp) }
  $stderr.puts "#{} 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 <ibc at>

More information about the mongrel-unicorn mailing list