Skip to content

Commit 7d3235b

Browse files
committed
By default, set log_line_prefix = '%m [%p] '.
This value might not be to everyone's taste; in particular, some people might prefer %t to %m, and others may want %u, %d, or other fields. However, it's a vast improvement on the old default of ''. Christoph Berg
1 parent 5ff4a67 commit 7d3235b

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

doc/src/sgml/config.sgml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5004,7 +5004,8 @@ local0.* /var/log/postgresql
50045004
value will pad on the left. Padding can be useful to aid human
50055005
readability in log files.
50065006
This parameter can only be set in the <filename>postgresql.conf</>
5007-
file or on the server command line. The default is an empty string.
5007+
file or on the server command line. The default is
5008+
<literal>'%m [%p] '</> which logs a time stamp and the process ID.
50085009

50095010
<informaltable>
50105011
<tgroup cols="3">
@@ -5142,6 +5143,17 @@ FROM pg_stat_activity;
51425143
include those escapes if you are logging to <application>syslog</>.
51435144
</para>
51445145
</tip>
5146+
5147+
<tip>
5148+
<para>
5149+
The <literal>%q</> escape is useful when including information that is
5150+
only available in session (backend) context like user or database
5151+
name. For example:
5152+
<programlisting>
5153+
log_line_prefix = '%m [%p] %q%u@%d/%a '
5154+
</programlisting>
5155+
</para>
5156+
</tip>
51455157
</listitem>
51465158
</varlistentry>
51475159

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3014,7 +3014,7 @@ static struct config_string ConfigureNamesString[] =
30143014
gettext_noop("If blank, no prefix is used.")
30153015
},
30163016
&Log_line_prefix,
3017-
"",
3017+
"%m [%p] ",
30183018
NULL, NULL, NULL
30193019
},
30203020

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@
430430
#log_duration = off
431431
#log_error_verbosity = default # terse, default, or verbose messages
432432
#log_hostname = off
433-
#log_line_prefix = '' # special values:
433+
#log_line_prefix = '%m [%p] ' # special values:
434434
# %a = application name
435435
# %u = user name
436436
# %d = database name

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy