Re: Suppressing Error messages.

Поиск
Список
Период
Сортировка
От Ragnar Hafstað
Тема Re: Suppressing Error messages.
Дата
Msg-id 1123703994.19316.15.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Suppressing Error messages.  ("Basith Salman" <bsalman@lemurnetworks.net>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: 5 new entries for FAQ
Следующее
От: Shane
Дата:
Сообщение: Re: Index not being used unless enable_seqscan=false