diff options
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/error/elog.c | 28 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index f8ae94729cc..62eef7b71f4 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -72,6 +72,7 @@ #include "libpq/pqformat.h" #include "mb/pg_wchar.h" #include "miscadmin.h" +#include "postmaster/bgworker.h" #include "postmaster/postmaster.h" #include "postmaster/syslogger.h" #include "storage/ipc.h" @@ -2492,6 +2493,23 @@ log_line_prefix(StringInfo buf, ErrorData *edata) padding > 0 ? padding : -padding); break; + case 'b': + { + const char *backend_type_str; + + if (MyProcPid == PostmasterPid) + backend_type_str = "postmaster"; + else if (MyBackendType == B_BG_WORKER) + backend_type_str = MyBgworkerEntry->bgw_type; + else + backend_type_str = GetBackendTypeDesc(MyBackendType); + + if (padding != 0) + appendStringInfo(buf, "%*s", padding, backend_type_str); + else + appendStringInfoString(buf, backend_type_str); + break; + } case 'u': if (MyProcPort) { @@ -2920,6 +2938,16 @@ write_csvlog(ErrorData *edata) if (application_name) appendCSVLiteral(&buf, application_name); + appendStringInfoChar(&buf, ','); + + /* backend type */ + if (MyProcPid == PostmasterPid) + appendCSVLiteral(&buf, "postmaster"); + else if (MyBackendType == B_BG_WORKER) + appendCSVLiteral(&buf, MyBgworkerEntry->bgw_type); + else + appendCSVLiteral(&buf, GetBackendTypeDesc(MyBackendType)); + appendStringInfoChar(&buf, '\n'); /* If in the syslogger process, try to write messages direct to file */ diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index e58e4788a8e..aa44f0c9bf2 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -528,6 +528,7 @@ # %d = database name # %r = remote host and port # %h = remote host + # %b = backend type # %p = process ID # %t = timestamp without milliseconds # %m = timestamp with milliseconds |