Re: BUG #7559: syslogger doesn't close stdout and stderr - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #7559: syslogger doesn't close stdout and stderr
Date
Msg-id 17544.1348153582@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #7559: syslogger doesn't close stdout and stderr  (Reinhard Max <reinhard@m4x.de>)
Responses Re: BUG #7559: syslogger doesn't close stdout and stderr  (Reinhard Max <reinhard@m4x.de>)
Re: BUG #7559: syslogger doesn't close stdout and stderr  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
Reinhard Max <reinhard@m4x.de> writes:
> After starting PostgreSQL with pg_init, stdout and stderr of all
> processes are pipes to the logger (as intended), but the logger itself
> still has FDs 1 and 2 open as inherited from pg_init. I think
> requiring the caller of pg_init to redirect them is not practical,
> because then pg_init itself can't give feedback to the user.

That's a fair point.  (I assume you mean pg_ctl not pg_init?)

> So it has
> to be done either in pg_init or in the logger when those channels
> aren't needed anymore. I'd prefer doing it in the logger, because the
> code for it is already there and so that it also works when starting
> PostgreSQL without using pg_init.

Well, I would have no objection to changing pg_ctl so that it redirects
the postmaster's stdout/stderr when a -l switch is given (actually,
I thought it did that already...).  I do object to changing the logger's
behavior as you suggest, because that will break use-cases that work
today.  One that I've used personally is adding "fprintf(stderr)" calls
in the logger for debugging the logger itself.

            regards, tom lane

pgsql-bugs by date:

Previous
From: l1t@tom.com
Date:
Subject: BUG #7556 addition info
Next
From: mayank.mittal.1982@hotmail.com
Date:
Subject: BUG #7562: could not read block 0 in file "base/16385/16585": read only 0 of 8192 bytes