log_line_prefix
A configuration parameter determining the format of the first part of each log line
log_line_prefix
is a configuration parameter determining the format of the first part of each log line.
log_line_prefix
was added in PostgreSQL 8.0.
Default value
The default value for log_line_prefix
is:
- PostgreSQL 10 and later:
'%m [%p] '
- PostgreSQL 8.0 ~ 9.6:
''
(empty string).
Change history
- PostgreSQL 14
- PostgreSQL 13
%b
parameter added to show the backend type (commit 70a7b477)
- PostgreSQL 10
- default changed from empty string to '
%m [%p]
' (commit 7d3235ba)
- default changed from empty string to '
- PostgreSQL 9.6
%n
parameter added to show the Unix epoch (commit f828654e)
- PostgreSQL 9.4
printf
-style padding specifications permitted (commit 4334639f)
- PostgreSQL 9.0
%e
parameter added to show the current SQL state (commit f39df967)
- PostgreSQL 8.0
- added (commit 2d3fe86b)
Examples
Log output with log_line_prefix
set to '%m [%p]
' (the default in PostgreSQL 10 and later):
2020-12-11 10:17:18.405 CET [10070] LOG: statement: SELECT error; 2020-12-11 10:17:18.406 CET [10070] ERROR: column "error" does not exist at character 8 2020-12-11 10:17:18.406 CET [10070] STATEMENT: SELECT error;
References
- PostgreSQL documentation: log_line_prefix