El Martes, 5 de Enero de 2010, Robert Klemme escribi=F3:
> Frankly, I believe redirecting stderr to a logger instance is a broken=20
> approach.  Why?  A logger has a completely different interface, i.e. it=20
> accepts at least a log level and the message to log.  Based on that it=20
> decides whether to output the message and how to format it.  A stream=20
> like stderr readily accepts anything send to it and it will output it=20
> (if there are no errors of course).  There is no formatting or deciding=20
> going on.
>=20
> I do not know your use case or what you want to achieve with this but it=
=20
> seems redirecting a stream of bytes to a logger is not a good idea on=20
> the design level already.

Yes, you are right. I did a hack by creating a modification of SyslogLogger=
=20
and then:

  $stderr =3D SyslogLogger.new("foo")

However it's really a hack since it's just valid for "warn" method and some=
=20
others using "$stderr.puts". But the real stderr remains being /dev/pts/N s=
o=20
if the application raises it would write on the terminal.

=46inally I've dropped the idea of using a Logger as $stderr.

Thanks.


=2D-=20
I=F1aki Baz Castillo <ibc / aliax.net>