Lists: | pgsql-hackers |
---|
From: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | SQL state in log_line_prefix |
Date: | 2009-05-10 12:32:26 |
Message-ID: | 1d4e0c10905100532i6c6c1705o4aa4e3c5168c4bca@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi -hackers,
A customer of us recently wanted to separate user errors from system
errors as different teams are working on these 2 types of errors and
while they might want to ignore user errors (bad-written SQL queries
and so on), they want to be sure system errors are analyzed carefully.
A good way to differentiate the 2 types of errors is to use the SQL state.
Currently, the only way to have the SQL state in the standard log file
is to do verbose logging which is, well..., verbose.
I attached a patch which allows to add the SQL state code into the
log_line_prefix. I used %e (as in error) as %s is already used.
Any comment?
--
Guillaume
Attachment | Content-Type | Size |
---|---|---|
postgresql-log_line_prefix-sql_state.diff | text/x-patch | 7.1 KB |
From: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-05-10 12:52:58 |
Message-ID: | 1d4e0c10905100552s7f29a811j7ca7d675c3422518@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, May 10, 2009 at 2:32 PM, Guillaume Smet
<guillaume(dot)smet(at)gmail(dot)com> wrote:
> I attached a patch which allows to add the SQL state code into the
> log_line_prefix. I used %e (as in error) as %s is already used.
Patch added to the next commit fest page.
--
Guillaume
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-05-10 13:29:38 |
Message-ID: | 4A06D6C2.9020107@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Guillaume Smet wrote:
> Hi -hackers,
>
> A customer of us recently wanted to separate user errors from system
> errors as different teams are working on these 2 types of errors and
> while they might want to ignore user errors (bad-written SQL queries
> and so on), they want to be sure system errors are analyzed carefully.
>
> A good way to differentiate the 2 types of errors is to use the SQL state.
>
> Currently, the only way to have the SQL state in the standard log file
> is to do verbose logging which is, well..., verbose.
>
> I attached a patch which allows to add the SQL state code into the
> log_line_prefix. I used %e (as in error) as %s is already used.
>
> Any comment?
>
>
If we're going to do this I think it needs to be added to CSV log output
too.
cheers
andrew
From: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-05-10 13:34:29 |
Message-ID: | 1d4e0c10905100634l2406237dg650780c205bfcb7e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, May 10, 2009 at 3:29 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> If we're going to do this I think it needs to be added to CSV log output
> too.
AFAICS, it's already done for the CSV output hence my "the only way to
have the SQL state in the *standard* log file".
Did I miss something?
Thanks for your feedback.
--
Guillaume
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-05-10 14:05:06 |
Message-ID: | 4A06DF12.5080606@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Guillaume Smet wrote:
> On Sun, May 10, 2009 at 3:29 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>> If we're going to do this I think it needs to be added to CSV log output
>> too.
>>
>
> AFAICS, it's already done for the CSV output hence my "the only way to
> have the SQL state in the *standard* log file".
>
> Did I miss something?
>
>
>
Oh, you're right. Sorry for the noise.
cheers
andrew
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-05-10 14:07:55 |
Message-ID: | 20833.1241964475@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> writes:
> A customer of us recently wanted to separate user errors from system
> errors as different teams are working on these 2 types of errors and
> while they might want to ignore user errors (bad-written SQL queries
> and so on), they want to be sure system errors are analyzed carefully.
> A good way to differentiate the 2 types of errors is to use the SQL state.
This might or might not be worth doing, but it seems pretty nearly
entirely useless for the claimed purpose. What is your division between
"user errors" and "system errors", and how will the SQLSTATE help you
make that?
regards, tom lane
From: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-05-10 14:21:14 |
Message-ID: | 1d4e0c10905100721o5d73cbdcp706d528078cca5d8@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, May 10, 2009 at 4:07 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> This might or might not be worth doing, but it seems pretty nearly
> entirely useless for the claimed purpose. What is your division between
> "user errors" and "system errors", and how will the SQLSTATE help you
> make that?
We use http://www.postgresql.org/docs/8.3/interactive/errcodes-appendix.html
to sort the errors.
For example:
Class 22 — Data Exception -> user
Class 53 — Insufficient Resources -> system
Class XX — Internal Error -> system
It's not perfect but it's the best way we found to classify them at the moment.
--
Guillaume
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-07-03 19:14:47 |
Message-ID: | 200907032214.47854.peter_e@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sunday 10 May 2009 15:32:26 Guillaume Smet wrote:
> I attached a patch which allows to add the SQL state code into the
> log_line_prefix. I used %e (as in error) as %s is already used.
Committed.
From: | Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: SQL state in log_line_prefix |
Date: | 2009-07-03 22:54:14 |
Message-ID: | 1d4e0c10907031554q414acefbn690e6b6ed29af150@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Jul 3, 2009 at 9:14 PM, Peter Eisentraut<peter_e(at)gmx(dot)net> wrote:
> On Sunday 10 May 2009 15:32:26 Guillaume Smet wrote:
>> I attached a patch which allows to add the SQL state code into the
>> log_line_prefix. I used %e (as in error) as %s is already used.
>
> Committed.
Thanks Peter.
--
Guillaume