pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedWhy does log_error_verbosity not apply to server logs?
7+ messages / 3 participants
[nested] [flat]
* Why does log_error_verbosity not apply to server logs?
@ 2019-04-22 20:30 Jeremy Finzel <finzelj@gmail.com>
0 siblings, 2 replies; 7+ messages in thread
From: Jeremy Finzel @ 2019-04-22 20:30 UTC (permalink / raw)
To: pgsql-general
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.
Is there any way to suppress these when called in a DO block like this?
Thanks,
Jeremy
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why does log_error_verbosity not apply to server logs?
@ 2019-04-22 20:47 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jeremy Finzel <finzelj@gmail.com>
1 sibling, 1 reply; 7+ messages in thread
From: Tom Lane @ 2019-04-22 20:47 UTC (permalink / raw)
To: Jeremy Finzel <finzelj@gmail.com>; +Cc: pgsql-general
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why does log_error_verbosity not apply to server logs?
@ 2019-04-22 20:47 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Jeremy Finzel <finzelj@gmail.com>
1 sibling, 0 replies; 7+ messages in thread
From: Adrian Klaver @ 2019-04-22 20:47 UTC (permalink / raw)
To: Jeremy Finzel <finzelj@gmail.com>; pgsql-general
On 4/22/19 1:30 PM, Jeremy Finzel wrote:
> 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.
>
> Is there any way to suppress these when called in a DO block like this?
Well the docs:
https://www.postgresql.org/docs/11/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT
say this can only be changed by a superuser.
So are you doing it as a superuser?
Can you show how you are modifying the setting?
>
> Thanks,
> Jeremy
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why does log_error_verbosity not apply to server logs?
@ 2019-04-22 20:54 Jeremy Finzel <finzelj@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 7+ messages in thread
From: Jeremy Finzel @ 2019-04-22 20:54 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general
On Mon, Apr 22, 2019 at 3:47 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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
>
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.
Thanks,
Jeremy
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why does log_error_verbosity not apply to server logs?
@ 2019-04-22 21:18 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Jeremy Finzel <finzelj@gmail.com>
1 sibling, 0 replies; 7+ messages in thread
From: Adrian Klaver @ 2019-04-22 21:18 UTC (permalink / raw)
To: Jeremy Finzel <finzelj@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general
On 4/22/19 1:54 PM, Jeremy Finzel wrote:
>
>
> On Mon, Apr 22, 2019 at 3:47 PM Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
> Jeremy Finzel <finzelj@gmail.com <mailto: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
>
>
> 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.klaver@aklaver.com
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why does log_error_verbosity not apply to server logs?
@ 2019-04-22 21:26 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jeremy Finzel <finzelj@gmail.com>
1 sibling, 1 reply; 7+ messages in thread
From: Tom Lane @ 2019-04-22 21:26 UTC (permalink / raw)
To: Jeremy Finzel <finzelj@gmail.com>; +Cc: pgsql-general
Jeremy Finzel <finzelj@gmail.com> writes:
> On Mon, Apr 22, 2019 at 3:47 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Sure sounds to me like what you are setting is something client-side,
>> not the server's log verbosity. It works for me:
> I am running it differently - explicitly raising a LOG level message, not
> an ERROR. The line of interest is the following:
My question was about how you (think you are) setting log_error_verbosity,
not what you're doing to produce the message. The decisions in elog.c
about which fields to print in the server log do not depend on the latter.
However... looking again at what elog.c does, I'm prompted to ask whether
you're using plain or CSV log output. The CSV log format doesn't
consider log_error_verbosity when deciding whether to output this field.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Why does log_error_verbosity not apply to server logs?
@ 2019-04-23 13:20 Jeremy Finzel <finzelj@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Jeremy Finzel @ 2019-04-23 13:20 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general
>
> My question was about how you (think you are) setting log_error_verbosity,
> not what you're doing to produce the message. The decisions in elog.c
> about which fields to print in the server log do not depend on the latter.
>
Roger that.
> However... looking again at what elog.c does, I'm prompted to ask whether
> you're using plain or CSV log output. The CSV log format doesn't
> consider log_error_verbosity when deciding whether to output this field.
>
Yup, we are using CSV log format. So in that case, is there no way around
the context messages if I still want the log message?
Thanks,
Jeremy
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2019-04-23 13:20 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 20:30 Why does log_error_verbosity not apply to server logs? Jeremy Finzel <finzelj@gmail.com>
2019-04-22 20:47 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-04-22 20:54 ` Jeremy Finzel <finzelj@gmail.com>
2019-04-22 21:18 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-04-22 21:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-04-23 13:20 ` Jeremy Finzel <finzelj@gmail.com>
2019-04-22 20:47 ` Adrian Klaver <adrian.klaver@aklaver.com>
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