[Spread-users] Spread output different when redirected?

Matt Garman matthew.garman at gmail.com
Mon Oct 30 12:08:49 EST 2006


On 10/30/06, John Lane Schultz <jschultz at spreadconcepts.com> wrote:
> Matt Garman wrote:
> > Or is it a matter of stdout/stderr not being flushed?  I would think
> > though, that the OS (or even spread itself) would flush all output
> > buffers before exiting.
>
> I doubt that.  I'd double check and ensure that the redirection command you are
> using is correct.

Well, I've done some more investigation.  At first, I was under the
impression that, even if you use the EventLogFile configuration
directive, some information was still written to stdout or stderr
(rather than the specified log file).  However, as far as I can tell,
it looks like only the initial splash screen is written to stdout.
Then, the config file is read and the rest of the output goes to the
log file.

Anyway, I'd still prefer to use redirection rather than the
EventLogFile directive.  As a test, I added these two lines to the
very beginning of main() in daemon/spread.c:

    setvbuf(stderr, (char*)0, _IONBF, 0);
    setvbuf(stdout, (char*)0, _IONBF, 0);

And then, when using redirection, everything made it into the file.

So, my current hypothesis is that, by default, the OS must define the
buffering behavior as _IOFBF (i.e. full buffering).

Thank you,
matt




More information about the Spread-users mailing list