Re: Suppressing Error messages.

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: bsalman(at)lemurnetworks(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Suppressing Error messages.
Date: 2005-08-10 19:59:54
Message-ID: 1123703994.19316.15.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2005-08-05 at 07:42 -0700, Basith Salman wrote:
>
> Hi All,
>
> I was wondering if there is way to suppress the error messages on the stdout
> from a perl dbi execute command, basically if I do a
> sth->execute() on a command and say the row cannot be updated then
> I get a err msg to stdout if there is foreign key violation, I want this error message
> to be directed to a log file.

>From perldoc DBI:

"PrintError" (boolean, inherited)
The "PrintError" attribute can be used to force errors to
generate warnings (using "warn") in addition to returning
error codes in
the normal way. When set "on", any method which results in
an error occuring will cause the DBI to effectively do a
"warn("$class $method failed: $DBI::errstr")" where $class
is the driver class and $method is the name of the method
which failed. E.g.,
...
By default, "DBI->connect" sets "PrintError" "on".

If desired, the warnings can be caught and processed using a
$SIG{__WARN__} handler or modules like CGI::Carp and CGI::ErrorWrap.

is this what you want ?

it seems that the error messages go to STDERR, not STDOUT.
maybe a 2> error.log ?

gnari

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2005-08-10 20:09:23 Re: Inheritance vs. LIKE - need advice
Previous Message Shane 2005-08-10 19:58:24 Re: Index not being used unless enable_seqscan=false