From: Robert Haas Date: Mon, 17 Oct 2016 20:31:13 +0000 (-0400) Subject: By default, set log_line_prefix = '%m [%p] '. X-Git-Tag: REL_10_BETA1~1554 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d3235ba42f8d5fc70c58e242702cc5e2e3549a6;p=postgresql 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 --- diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index e826c19698..99ff9f5ab5 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -5004,7 +5004,8 @@ local0.* /var/log/postgresql value will pad on the left. Padding can be useful to aid human readability in log files. This parameter can only be set in the postgresql.conf - file or on the server command line. The default is an empty string. + file or on the server command line. The default is + '%m [%p] ' which logs a time stamp and the process ID. @@ -5142,6 +5143,17 @@ FROM pg_stat_activity; include those escapes if you are logging to syslog. + + + + The %q escape is useful when including information that is + only available in session (backend) context like user or database + name. For example: + +log_line_prefix = '%m [%p] %q%u@%d/%a ' + + + diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 622279b058..65660c1bf7 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -3014,7 +3014,7 @@ static struct config_string ConfigureNamesString[] = gettext_noop("If blank, no prefix is used.") }, &Log_line_prefix, - "", + "%m [%p] ", NULL, NULL, NULL }, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 05b1373594..159ada3bc6 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -430,7 +430,7 @@ #log_duration = off #log_error_verbosity = default # terse, default, or verbose messages #log_hostname = off -#log_line_prefix = '' # special values: +#log_line_prefix = '%m [%p] ' # special values: # %a = application name # %u = user name # %d = database name