1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Try to make silent_mode behave somewhat reasonably.

Instead of sending stdout/stderr to /dev/null after forking away from the
terminal, send them to postmaster.log within the data directory.  Since
this opens the door to indefinite logfile bloat, recommend even more
strongly that log output be redirected when using silent_mode.

Move the postmaster's initial calls of load_hba() and load_ident() down
to after we have started the log collector, if we are going to.  This
is so that errors reported by them will appear in the "usual" place.

Reclassify silent_mode as a LOGGING_WHERE, not LOGGING_WHEN, parameter,
since it's got absolutely nothing to do with the latter category.

In passing, fix some obsolete references to -S ... this option hasn't
had that switch letter for a long time.

Back-patch to 8.4, since as of 8.4 load_hba() and load_ident() are more
picky (and thus more likely to fail) than they used to be.  This entire
change was driven by a complaint about those errors disappearing into
the bit bucket.
This commit is contained in:
Tom Lane
2009-08-24 20:08:32 +00:00
parent 5a4f763841
commit 8bed238c87
4 changed files with 111 additions and 56 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.223 2009/08/04 16:08:35 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.224 2009/08/24 20:08:31 tgl Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
@ -2588,7 +2588,37 @@ local0.* /var/log/postgresql
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-silent-mode" xreflabel="silent_mode">
<term><varname>silent_mode</varname> (<type>boolean</type>)</term>
<indexterm>
<primary><varname>silent_mode</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
Runs the server silently. If this parameter is set, the server
will automatically run in background and disassociate from the
controlling terminal.
This parameter can only be set at server start.
</para>
<caution>
<para>
When this parameter is set,
the server's standard output and standard error are redirected
to the file <filename>postmaster.log</> within the data directory.
There is no provision for rotating this file, so it will grow
indefinitely unless server log output is redirected elsewhere
by other settings. It is recommended that <varname>log_destination</>
be set to <literal>syslog</> or that <varname>logging_collector</> be
enabled when using this option. Even with those measures, errors
reported early during startup may appear in
<filename>postmaster.log</> rather than the normal log destination.
</para>
</caution>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="runtime-config-logging-when">
@ -2722,26 +2752,6 @@ local0.* /var/log/postgresql
</listitem>
</varlistentry>
<varlistentry id="guc-silent-mode" xreflabel="silent_mode">
<term><varname>silent_mode</varname> (<type>boolean</type>)</term>
<indexterm>
<primary><varname>silent_mode</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
Runs the server silently. If this parameter is set, the server
will automatically run in background and any controlling
terminals are disassociated.
The server's standard output and standard error are redirected
to <literal>/dev/null</>, so any messages sent to them will be lost.
Unless <application>syslog</> logging is selected or
<varname>logging_collector</> is enabled, using this parameter
is discouraged because it makes it impossible to see error messages.
This parameter can only be set at server start.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>