Re: warn in plperl logs as... NOTICE?? - Mailing list pgsql-hackers

From Tim Bunce
Subject Re: warn in plperl logs as... NOTICE??
Date
Msg-id 20100122124301.GD2294@timac.local
Whole thread Raw
In response to Re: warn in plperl logs as... NOTICE??  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On Thu, Jan 21, 2010 at 07:55:09PM -0500, Andrew Dunstan wrote:
> Tom Lane wrote:
> >Andrew Dunstan <andrew@dunslane.net> writes:
> >>Jim Nasby wrote:
> >>>Why does warn; in plperl log as NOTICE in Postgres?
> >
> >>Where would you like the warning to go? This has been this way
> >>for nearly 5 years, it's not new (and before that the warning
> >>didn't go anywhere).
> >
> >I think he's suggesting that it ought to translate as elog(WARNING)
> >not elog(NOTICE).
> 
> *shrug* I don't have a strong opinion about it, and it's pretty easy
> to change, if there's a consensus we should. I have certainly found
> over the years that perl warnings from some modules can be
> annoyingly verbose, which is probably why the original patch didn't
> make them have a higher level in Postgres. If this were a big issue
> we'd have surely heard about it before now - there are plenty of
> plperl users out there.

I've no particular opinion either way on this. I can't resist the
tempation, however, to point out that this is an example the kind of
site-preference that could be handled via plperl.on_perl_init:
   plperl.on_perl_init='$SIG{__WARN__} = sub { elog(WARNING, shift) }'
or   plperl.on_perl_init='use lib "/MyApp/lib"; use MyApp::PLPerlInit;'

You could get more fancy and employ some logic to using WARNING for the
first instance of any given message text and NOTICE for subsequent ones.

Tim.


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: quoting psql varible as identifier
Next
From: Peter Eisentraut
Date:
Subject: Re: commit fests (was Re: primary key error message)