Adding application_name to the error and notice message fields

Started by Mitaralmost 2 years ago2 messages
#1Mitar
mmitar@gmail.com

Hi!

We take care to always set application_name to improve our log lines
where we use %a in log_line_prefix to log application name, per [1]https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-LINE-PREFIX.
But notices which are sent to the client do not have the application
name and are thus hard to attribute correctly. Could "a" be added with
the application name (when available) to the error and notice message
fields [2]https://www.postgresql.org/docs/current/protocol-error-fields.html?

Mitar

[1]: https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
[2]: https://www.postgresql.org/docs/current/protocol-error-fields.html

--
https://mitar.tnode.com/
https://twitter.com/mitar_m
https://noc.social/@mitar

#2Mitar
mmitar@gmail.com
In reply to: Mitar (#1)
Re: Adding application_name to the error and notice message fields

Hi!

Oh, I can use PQparameterStatus to obtain application_name of the
current connection. It seems then it is not needed to add this
information into notice message.

Mitar

On Wed, Mar 27, 2024 at 4:22 PM Mitar <mmitar@gmail.com> wrote:

Hi!

We take care to always set application_name to improve our log lines
where we use %a in log_line_prefix to log application name, per [1].
But notices which are sent to the client do not have the application
name and are thus hard to attribute correctly. Could "a" be added with
the application name (when available) to the error and notice message
fields [2]?

Mitar

[1] https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
[2] https://www.postgresql.org/docs/current/protocol-error-fields.html

--
https://mitar.tnode.com/
https://twitter.com/mitar_m
https://noc.social/@mitar

--
https://mitar.tnode.com/
https://twitter.com/mitar_m
https://noc.social/@mitar