Re: backend type in log_line_prefix? - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: backend type in log_line_prefix?
Date
Msg-id 20200314154948.GU29065@telsasoft.com
Whole thread Raw
In response to Re: backend type in log_line_prefix?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
On Fri, Feb 21, 2020 at 10:09:38AM +0100, Peter Eisentraut wrote:
> From 75ac8ed0c47801712eb2aa300d9cb29767d2e121 Mon Sep 17 00:00:00 2001
> From: Peter Eisentraut <peter@eisentraut.org>
> Date: Thu, 20 Feb 2020 18:16:39 +0100
> Subject: [PATCH v2 3/4] Add backend type to csvlog and optionally log_line_prefix

> diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
> index c1128f89ec..206778b1c3 100644
> --- a/doc/src/sgml/config.sgml
> +++ b/doc/src/sgml/config.sgml
> @@ -6470,6 +6470,11 @@ <title>What to Log</title>

          characters are copied straight to the log line. Some escapes are
          only recognized by session processes, and will be treated as empty by
          background processes such as the main server process. Status
...
              <entry>Escape</entry>
              <entry>Effect</entry>
              <entry>Session only</entry>

>               <entry>Application name</entry>
>               <entry>yes</entry>
>              </row>
> +            <row>
> +             <entry><literal>%b</literal></entry>
> +             <entry>Backend process type</entry>
> +             <entry>yes</entry>

=> should say "no", it's not blank for background processes:

> +
> +                    if (MyProcPid == PostmasterPid)
> +                        backend_type_str = "postmaster";
> +                    else if (MyBackendType == B_BG_WORKER)
> +                        backend_type_str = MyBgworkerEntry->bgw_type;
> +                    else
> +                        backend_type_str = pgstat_get_backend_desc(MyBackendType);

-- 
Justin



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: PATCH: add support for IN and @> in functional-dependencystatistics use
Next
From: James Coleman
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)