Thread: libpq and PostgreSQL NOTICEs

libpq and PostgreSQL NOTICEs

From
"Tim Barnard"
Date:
Is there any way to force Postgre not to send NOTICEs to the console? I have an ncurses app that from time to time gets notices stating that "begin is already a transaction in progress." Now I know I need to track down where I'm issuing a "begin" twice, but I would rather Postgre log these warnings and errors to a file, rather than spewing across the screen. Does anyone know if and how to instruct Postgre to send its NOTICEs to a log file?
 
Tim
 

Re: libpq and PostgreSQL NOTICEs

From
"Tim Barnard"
Date:
Hmm, well it is, or appears to be. Here's how postmaster starts:

  su - cvms -c "(/usr/local/pgsql/bin/postmaster -D/progs/db -B 256
      2>&1 | logger -p local5.notice) &" > /dev/null  2>&1 &

Problem is, NOTICE's still goes to the console.
Any other ideas? This is really driving me bonkers!?!?!  :-)

Tim

----- Original Message -----
From: "Andrew Sullivan" <andrew@libertyrms.com>
To: "Tim Barnard" <tbarnard@povn.com>
Sent: Monday, June 04, 2001 11:23 AM
Subject: Re: [GENERAL] libpq and PostgreSQL NOTICEs


> On Mon, Jun 04, 2001 at 10:59:14AM -0700, Tim Barnard wrote:
> > rather than spewing across the screen. Does anyone know if and how
> > to instruct Postgre to send its NOTICEs to a log file?
>
> Sure.  When starting postgres, send its output to a file:
>
> postmaster [stuff] > /some/log 2>&1 &
>
> That's if you're using a Bourne-style shell.
>
> A
>
> --
> ----
> Andrew Sullivan                               87 Mowat Avenue
> Liberty RMS                           Toronto, Ontario Canada
> <andrew@libertyrms.com>                               M6K 3E3
>                                          +1 416 646 3306 x110
>
>


Re: libpq and PostgreSQL NOTICEs

From
Tom Lane
Date:
"Tim Barnard" <tbarnard@povn.com> writes:
> Is there any way to force Postgre not to send NOTICEs to the console?

Define "console" --- you mean the client's stderr?  Or the postmaster's?

Changing libpq's notice processor (see PQsetNoticeProcessor) would help
if you want to filter notices on the client side.

            regards, tom lane

Re: libpq and PostgreSQL NOTICEs

From
"Tim Barnard"
Date:
The 'client' side.  Thanks, I'll give it a try.

Tim

----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Tim Barnard" <tbarnard@povn.com>
Cc: <pgsql-general@postgresql.org>
Sent: Monday, June 04, 2001 1:40 PM
Subject: Re: [GENERAL] libpq and PostgreSQL NOTICEs


> "Tim Barnard" <tbarnard@povn.com> writes:
> > Is there any way to force Postgre not to send NOTICEs to the console?
>
> Define "console" --- you mean the client's stderr?  Or the postmaster's?
>
> Changing libpq's notice processor (see PQsetNoticeProcessor) would help
> if you want to filter notices on the client side.
>
> regards, tom lane
>