From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeremy Finzel <finzelj@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Why does log_error_verbosity not apply to server logs?
Date: Mon, 22 Apr 2019 16:47:20 -0400
Message-ID: <26062.1555966040@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMa1XUjm5o7xUDqmVps-s35xQRBuLYU8eX7boFSZa+7bsgJwCA@mail.gmail.com>
References: <CAMa1XUjm5o7xUDqmVps-s35xQRBuLYU8eX7boFSZa+7bsgJwCA@mail.gmail.com>
Jeremy Finzel <finzelj@gmail.com> writes:
> I have a DO block which is raising a log message with number of rows
> deleted. It also shows CONTEXT messages every time, which I don't want.
> But setting in the client log_error_verbosity = terse does not work to get
> rid of the messages. I can't get it to work even setting it on a per-user
> level.
> My client shows terse verbosity as expected, but the server logs always no
> matter what have CONTEXT messages.
Sure sounds to me like what you are setting is something client-side,
not the server's log verbosity. It works for me:
regression=# do $$ declare x int; y int = 0; begin x := 1/y; end$$;
psql: ERROR: division by zero
CONTEXT: PL/pgSQL function inline_code_block line 1 at assignment
regression=# set log_error_verbosity = terse;
SET
regression=# do $$ declare x int; y int = 0; begin x := 1/y; end$$;
psql: ERROR: division by zero
CONTEXT: PL/pgSQL function inline_code_block line 1 at assignment
after which I see this in the postmaster log:
2019-04-22 16:40:38.300 EDT [25788] ERROR: division by zero
2019-04-22 16:40:38.300 EDT [25788] CONTEXT: PL/pgSQL function inline_code_block line 1 at assignment
2019-04-22 16:40:38.300 EDT [25788] STATEMENT: do $$ declare x int; y int = 0; begin x := 1/y; end$$;
2019-04-22 16:40:51.654 EDT [25788] ERROR: division by zero
2019-04-22 16:40:51.654 EDT [25788] STATEMENT: do $$ declare x int; y int = 0; begin x := 1/y; end$$;
Note that this changed the server log verbosity but *not*
what was displayed on the client side.
(BTW, if you want to get rid of the statement logging as well,
see log_min_error_statement.)
Also note that adjusting log_error_verbosity on the fly
like this requires being superuser, which isn't really
a good way to run in production. I'd expect though that
you could apply it with ALTER USER SET.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, finzelj@gmail.com
Subject: Re: Why does log_error_verbosity not apply to server logs?
In-Reply-To: <26062.1555966040@sss.pgh.pa.us>
References: <CAMa1XUjm5o7xUDqmVps-s35xQRBuLYU8eX7boFSZa+7bsgJwCA@mail.gmail.com> <26062.1555966040@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox