Re: Why does log_error_verbosity not apply to server logs?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why does log_error_verbosity not apply to server logs?
Date: 2019-04-22 21:18:01
Message-ID: 5a912f5a-35bd-f83d-cac7-1ad98830997e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/22/19 1:54 PM, Jeremy Finzel wrote:
>
>
> On Mon, Apr 22, 2019 at 3:47 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
>
> Jeremy Finzel <finzelj(at)gmail(dot)com <mailto:finzelj(at)gmail(dot)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
>
>
> I am running it differently - explicitly raising a LOG level message,
> not an ERROR.  The line of interest is the following:
>
> do $$
> ......
> raise log 'pruned % rows from table', rows;
> ...
>
> Even run as a superuser, it doesn't work. I have run it just as you did
> above - setting it client side.  Also done it on a per-role basis and it
> didn't work.

I tried to replicate your example and could not.

Questions:

1) Postgres version?

2) What is the actual message you are seeing in the log?

>
> Thanks,
> Jeremy

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-04-22 21:26:08 Re: Why does log_error_verbosity not apply to server logs?
Previous Message Jeremy Finzel 2019-04-22 20:54:20 Re: Why does log_error_verbosity not apply to server logs?