unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* stderr_path doesn't work at the moment of being called
@ 2010-01-05 10:26 Iñaki Baz Castillo
  2010-01-05 10:32 ` Iñaki Baz Castillo
  0 siblings, 1 reply; 4+ messages in thread
From: Iñaki Baz Castillo @ 2010-01-05 10:26 UTC (permalink / raw)
  To: mongrel-unicorn

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 <ibc@aliax.net>
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-05 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-05 10:26 stderr_path doesn't work at the moment of being called Iñaki Baz Castillo
2010-01-05 10:32 ` Iñaki Baz Castillo
2010-01-05 21:47   ` Eric Wong
2010-01-05 22:50     ` Iñaki Baz Castillo

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).