diff options
author | Neil Conway <neilc@samurai.com> | 2004-09-22 03:55:27 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-09-22 03:55:27 +0000 |
commit | a3c53c834f769b31052ac55d5fb939b7cc9a4ec1 (patch) | |
tree | 265c851ae6f896d268e801502e4c93b09eec19fc /src | |
parent | 665d3736fb69fc92eea3c268daa2ec5e021165b7 (diff) | |
download | postgresql-a3c53c834f769b31052ac55d5fb939b7cc9a4ec1.tar.gz postgresql-a3c53c834f769b31052ac55d5fb939b7cc9a4ec1.zip |
This patch from Alvaro Herrera adds transaction ID to the list of
log_line_prefix escapes. The escape sequence used for this is %x.
%x previously meant "postmaster et al. stop here" -- this has been
renamed to %q.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/error/elog.c | 15 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index ded96313c33..20ff94d7dda 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -42,7 +42,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.150 2004/09/05 03:42:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.151 2004/09/22 03:55:26 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -1421,12 +1421,21 @@ log_line_prefix(StringInfo buf) MyProcPort->remote_port); } break; - case 'x': - /* in postmaster and friends, stop if %x is seen */ + case 'q': + /* in postmaster and friends, stop if %q is seen */ /* in a backend, just ignore */ if (MyProcPort == NULL) i = format_len; break; + case 'x': + if (MyProcPort) + { + if (IsTransactionState()) + appendStringInfo(buf, "%u", GetTopTransactionId()); + else + appendStringInfo(buf, "%u", InvalidTransactionId); + } + break; case '%': appendStringInfoChar(buf, '%'); break; diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 749fa19beb0..5f83db9bd39 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -231,8 +231,8 @@ # %r=remote host and port # %p=PID %t=timestamp %i=command tag # %c=session id %l=session line number - # %s=session start timestamp - # %x=stop here in non-session processes + # %s=session start timestamp %x=transaction id + # %q=stop here in non-session processes # %%='%' #log_statement = 'none' # none, mod, ddl, all #log_hostname = false |