Re: Suppressing Error messages. - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: Suppressing Error messages.
Date
Msg-id 1123703994.19316.15.camel@localhost.localdomain
Whole thread Raw
In response to Suppressing Error messages.  ("Basith Salman" <bsalman@lemurnetworks.net>)
List 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



pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: 5 new entries for FAQ
Next
From: Shane
Date:
Subject: Re: Index not being used unless enable_seqscan=false