Thread: how to completely turn off statement error logging

how to completely turn off statement error logging

From
"Zwettler Markus (OIZ)"
Date:

I don't want to log statement errors in the server logfile – whether the statement string nor the error message.



I set "log_min_error_statement = panic" according to the docs:

 

<quote>

To effectively turn off logging of failing statements, set this parameter to PANIC.

</quote>



But error messages are still logged:

$ psql

psql (12.17)

SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)

Type "help" for help.

 

pcl_l300=# show log_min_error_statement;

log_min_error_statement

-------------------------

panic

(1 row)

 

pcl_l300=# select error_817 / 0;

ERROR:  column "error_817" does not exist

LINE 1: select error_817 / 0;

               ^

pcl_l300=# exit

$ fgrep error_817 pg_statsinfo.log

2024-05-13 16:01:14 CEST 36421 ERROR:  column "error_817" does not exist


Question: How can I turn off logging of this statement based error message?

 

Re: how to completely turn off statement error logging

From
Tom Lane
Date:
"Zwettler Markus (OIZ)" <Markus.Zwettler@zuerich.ch> writes:
> I don't want to log statement errors in the server logfile - whether the statement string nor the error message.

You need to set log_min_messages higher than ERROR.  You might
consider using LOG or FATAL rather than PANIC, though.

> I set "log_min_error_statement = panic" according to the docs:
> To effectively turn off logging of failing statements, set this parameter to PANIC.

This setting controls whether the STATEMENT: detail is appended to a
message, but not the basic choice of whether to emit the message.

            regards, tom lane



AW: [Extern] Re: how to completely turn off statement error logging

From
"Zwettler Markus (OIZ)"
Date:
> Von: Tom Lane <tgl@sss.pgh.pa.us>
> Gesendet: Montag, 13. Mai 2024 16:26
> An: Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
> Cc: pgsql-general@lists.postgresql.org
> Betreff: [Extern] Re: how to completely turn off statement error logging
> 
> "Zwettler Markus (OIZ)" <Markus.Zwettler@zuerich.ch> writes:
> > I don't want to log statement errors in the server logfile - whether the statement
> string nor the error message.
> 
> You need to set log_min_messages higher than ERROR.  You might consider
> using LOG or FATAL rather than PANIC, though.
> 
> > I set "log_min_error_statement = panic" according to the docs:
> > To effectively turn off logging of failing statements, set this parameter to
> PANIC.
> 
> This setting controls whether the STATEMENT: detail is appended to a message,
> but not the basic choice of whether to emit the message.
> 
>                         regards, tom lane
> --- Externe Email: Vorsicht mit Anhängen, Links oder dem Preisgeben von
> Informationen ---



please let me refine.

I would like to suppress all errors in the server logfile coming from client applications, i.e. statement level errors
suchas "duplicate key violates..."
 

but I do not want to suppress errors that are related to infrastructure problems, i.e. "could not open file..."

if I set log_min_messages higher than ERROR, errors concerning the infrastructure would also be suppressed, wouldn't
they?

thanks, markus

Re: how to completely turn off statement error logging

From
"David G. Johnston"
Date:
On Monday, May 13, 2024, Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch> wrote:

but I do not want to suppress errors that are related to infrastructure problems, i.e. "could not open file..."


The server doesn’t classify the errors it emits into scope, “application errors” and ”infrastructure errors”, or otherwise.  The only classification is severity.

It does include an SQL Error Code that you could, in post-processing, act on.

David J.