Re: mutilog via fifo

richard lucassen <[email protected]> Mon, 4 Aug 2008 12:35:19 +0200
Newsgroups gmane.comp.djb.syslog
Organization XAQ Systems
Message-ID <[email protected]>
On Mon, 04 Aug 2008 09:47:50 +0930
Daryl Tester <[email protected]> wrote:

> > I agree, normally there is the name of the logfile. Have a look at
> > it, it's a very small proxy for embedded systems:
> > 
> > http://dl.xaq.nl/linux/elhttp/
> 
> Well, the patch to make it work with stderr is "simple" (too simple -
> the original didn't check for failure upon opening, which would have
> shown up your issue with using /dev/stderr earlier).  Go to line 80,
> change (warning, untested) and recompile:
> 
>   td.logfile = ( argc > 4 ) ? fopen( argv[4], "a+" ) : NULL;
> 
> to read:
> 
>   td.logfile = ( argc > 4 ) ? fdopen(2, "w") : NULL;
>   setvbuf(td.logfile, (char *) NULL, _IONBF, 0);
> 
> (the setvbuf is to force the output to be unbuffered - I'm a
> mistrusting soul).

This works like a charm :)

> I'm still intrigued as to why the open of /dev/stderr is failing
> though.

Maybe Paul has some thoughts?

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+