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