debugsqlMinor
Postgresql Log message without its statement
Viewed 0 times
postgresqlwithoutlogstatementmessageits
Problem
If I want to write a message to the Postgres log I can do this:
However, it logs the statement as well so I get 5 lines of output instead of one:
I can reduce it to two lines with the following:
However is it possible to reduce it down to one? Is there a way to send a line of text to the Postgres log without postgres logging the statement that generated the log?
DO $
BEGIN
RAISE LOG 'Justin Is Awesome';
END $;However, it logs the statement as well so I get 5 lines of output instead of one:
2016-07-12 16:38:13 UTC LOG: Justin Is Awesome
2016-07-12 16:38:13 UTC STATEMENT: DO $
BEGIN
RAISE LOG 'Justin Is Awesome';
END $I can reduce it to two lines with the following:
2016-07-12 16:36:04 UTC LOG: Justin Is Awesome
2016-07-12 16:36:04 UTC STATEMENT: DO $ BEGIN RAISE LOG 'Justin Is Awesome'; END $However is it possible to reduce it down to one? Is there a way to send a line of text to the Postgres log without postgres logging the statement that generated the log?
Solution
If you want to suppress the "STATEMENT" information, then you could set
If you want to keep the STATEMENT information but compress it into a single line with the main entry, then you could set
log_min_error_statement = fatal (or panic).If you want to keep the STATEMENT information but compress it into a single line with the main entry, then you could set
log_destination = 'csvlog'. Technically it will still be multiple lines, but the internal newlines will be escaped by inclusion within double quotes, which any good csv parser will handle for you.Context
StackExchange Database Administrators Q#143631, answer score: 4
Revisions (0)
No revisions yet.