El Domingo, 3 de Enero de 2010, Eric Wong escribió:

>   # Totally untested, stick this in your Unicorn config file and let
>   # us know if it works or blows up badly:
> 
>   require 'syslog_logger'
> 
>   class MySyslogLogger < SyslogLogger
>     alias puts error
>     alias write error
>     def flush; self; end
>   end
> 
>   $stderr = MySyslogLogger.new('foo')


Unfortunatelly it doesn'w work very well. First of all Sysloglogger relies on 
a constant called SYSLOG created in "initialize" method so it's required to 
add the above methods to SyslogLogger class rather than subclass.

Anyhow, the main problem is that by doing "$stderr = SyslogLogger.new('foo')" 
the std error is not redirected as /proc/PID/fd still shows:

  2 -> /dev/pts/2

Of course by calling $stderr.puts "error" the above works, but when a real 
error raised it's is printed in the screen (/dev/pts/2).

I strongly think that IO#reopen is required. IO#reopen accepts a string (file 
path) or other IO, so "converting" SyslogLogger into a IO is required.

I'll try to achieve it.

Regards.




-- 
Iñaki Baz Castillo <i...@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

Reply via email to