Raised exceptions are not logged when USR2

Iñaki Baz Castillo ibc at aliax.net
Sun Jan 3 11:22:20 EST 2010


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

> Unfortunately, the stock Syslog module isn't compatible with the Ruby
> Logger implementation.  Try grabbing the "SyslogLogger" gem and using
> that instead.  I haven't had any experience with SyslogLogger, but a
> cursory look says it's OK.

Yes, in fact I already use a "bit" customized SyslogLogger :)

 
> If you really want to, you may be able to subclass SyslogLogger and give
> it IO-like methods (write/puts/flush) are require for Rack::Lint
> compatibility and then set $stderr:
> 
>   # 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')

Really great! It works fine :)

 
> > BTW, how to reset the $stderr so it points again to the default one (the
> > terminal)?
> 
> You would've had to dup stderr in the config file and keep it referenced
> before it got redirected.  But a daemonized process shouldn't be holding
> onto terminals...


Really thanks a lot. 


-- 
Iñaki Baz Castillo <ibc at aliax.net>


More information about the mongrel-unicorn mailing list