Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3f47e14

Browse files
committed
Improve documentation around logging_collector and use of stderr.
In backup.sgml, point out that you need to be using the logging collector if you want to log messages from a failing archive_command script. (This is an oversimplification, in that it will work without the collector as long as you're not sending postmaster stderr to /dev/null; but it seems like a good idea to encourage use of the collector to avoid problems with multiple processes concurrently scribbling on one file.) In config.sgml, do some wordsmithing of logging_collector discussion. Per bug #6518 from Janning Vygen
1 parent cecdf6d commit 3f47e14

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

doc/src/sgml/backup.sgml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,6 @@ archive_command = 'local_backup_script.sh "%p" "%f"'
12791279
This allows all complexity to be managed within the script, which
12801280
can be written in a popular scripting language such as
12811281
<application>bash</> or <application>perl</>.
1282-
Any messages written to <literal>stderr</> from the script will appear
1283-
in the database server log, allowing complex configurations to be
1284-
diagnosed easily if they fail.
12851282
</para>
12861283

12871284
<para>
@@ -1310,6 +1307,16 @@ archive_command = 'local_backup_script.sh "%p" "%f"'
13101307
</listitem>
13111308
</itemizedlist>
13121309
</para>
1310+
1311+
<tip>
1312+
<para>
1313+
When using an <varname>archive_command</varname> script, it's desirable
1314+
to enable <xref linkend="guc-logging-collector">.
1315+
Any messages written to <systemitem>stderr</> from the script will then
1316+
appear in the database server log, allowing complex configurations to
1317+
be diagnosed easily if they fail.
1318+
</para>
1319+
</tip>
13131320
</sect3>
13141321
</sect2>
13151322

doc/src/sgml/config.sgml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,7 +3123,7 @@ SELECT * FROM parent WHERE key = 2400;
31233123
value</> (<acronym>CSV</>) format, which is convenient for
31243124
loading logs into programs.
31253125
See <xref linkend="runtime-config-logging-csvlog"> for details.
3126-
<varname>logging_collector</varname> must be enabled to generate
3126+
<xref linkend="guc-logging-collector"> must be enabled to generate
31273127
CSV-format log output.
31283128
</para>
31293129

@@ -3163,24 +3163,39 @@ local0.* /var/log/postgresql
31633163
</indexterm>
31643164
<listitem>
31653165
<para>
3166-
This parameter captures plain and CSV-format log messages
3167-
sent to <application>stderr</> and redirects them into log files.
3166+
This parameter enables the <firstterm>logging collector</>, which
3167+
is a background process that captures log messages
3168+
sent to <systemitem>stderr</> and redirects them into log files.
31683169
This approach is often more useful than
31693170
logging to <application>syslog</>, since some types of messages
3170-
might not appear in <application>syslog</> output (a common example
3171-
is dynamic-linker failure messages).
3171+
might not appear in <application>syslog</> output. (One common
3172+
example is dynamic-linker failure messages; another is error messages
3173+
produced by scripts such as <varname>archive_command</>.)
31723174
This parameter can only be set at server start.
31733175
</para>
31743176

3177+
<note>
3178+
<para>
3179+
It is possible to log to <systemitem>stderr</> without using the
3180+
logging collector; the log messages will just go to wherever the
3181+
server's <systemitem>stderr</> is directed. However, that method is
3182+
only suitable for low log volumes, since it provides no convenient
3183+
way to rotate log files. Also, on some platforms not using the
3184+
logging collector can result in lost or garbled log output, because
3185+
multiple processes writing concurrently to the same log file can
3186+
overwrite each other's output.
3187+
</para>
3188+
</note>
3189+
31753190
<note>
31763191
<para>
31773192
The logging collector is designed to never lose messages. This means
31783193
that in case of extremely high load, server processes could be
3179-
blocked due to trying to send additional log messages when the
3194+
blocked while trying to send additional log messages when the
31803195
collector has fallen behind. In contrast, <application>syslog</>
3181-
prefers to drop messages if it cannot write them, which means it's
3182-
less reliable in those cases but it will not block the rest of the
3183-
system.
3196+
prefers to drop messages if it cannot write them, which means it
3197+
may fail to log some messages in such cases but it will not block
3198+
the rest of the system.
31843199
</para>
31853200
</note>
31863201

0 commit comments

Comments
 (0)