Re: BUG #3647: error message logged to stderr only, not redirect logfile

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michael Charnoky" <noky(at)nextbus(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3647: error message logged to stderr only, not redirect logfile
Date: 2007-10-02 21:19:47
Message-ID: 27859.1191359987@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Michael Charnoky" <noky(at)nextbus(dot)com> writes:
> If PostgreSQL fails to start (eg: the OS's SHMMAX wasn't set high enough to
> handle the requested 'shared_buffers'), the error message gets logged to
> stderr only and not the logfile in 'log_directory'. I would like to simply
> redirect stderr to /dev/null and just rely on the logfiles, but am worried
> that I might miss some error messages.

Sorry, this request is hopeless. While we could possibly start
redirecting a bit earlier than we do now, that wouldn't eliminate the
basic problem. There will *always* be some startup-time messages that
are vulnerable to this problem --- what if startup fails before it can
fork the log collector and redirect stderr, or even before it can read
the configuration file to find out it is supposed to redirect?

A good scheme is to use redirect_stderr, but also have the postmaster's
original stdout/stderr directed to a backup log file. You need not
worry about rotation of the backup log file, since it isn't expected to
accumulate much data, but it needs to be there to backstop the log
collector for startup problems and failures of the log collector itself.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Anton 2007-10-03 05:45:02 BUG #3648: Server crashes when trying to create a table
Previous Message Michael Charnoky 2007-10-02 18:34:18 BUG #3647: error message logged to stderr only, not redirect logfile