Re: BUG #3647: error message logged to stderr only, not redirect logfile - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #3647: error message logged to stderr only, not redirect logfile
Date
Msg-id 27859.1191359987@sss.pgh.pa.us
Whole thread Raw
In response to BUG #3647: error message logged to stderr only, not redirect logfile  ("Michael Charnoky" <noky@nextbus.com>)
List pgsql-bugs
"Michael Charnoky" <noky@nextbus.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

pgsql-bugs by date:

Previous
From: "Michael Charnoky"
Date:
Subject: BUG #3647: error message logged to stderr only, not redirect logfile
Next
From: "Anton"
Date:
Subject: BUG #3648: Server crashes when trying to create a table