Re: BUG #7559: syslogger doesn't close stdout and stderr

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reinhard Max <reinhard(at)m4x(dot)de>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7559: syslogger doesn't close stdout and stderr
Date: 2012-09-20 15:06:22
Message-ID: 17544.1348153582@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Reinhard Max <reinhard(at)m4x(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Reinhard Max 2012-09-20 16:02:33 Re: BUG #7559: syslogger doesn't close stdout and stderr
Previous Message Reinhard Max 2012-09-20 09:11:59 Re: BUG #7559: syslogger doesn't close stdout and stderr