Thread: Feature Request: PSQLException verbosity option

Feature Request: PSQLException verbosity option

From
Daniel Migowski
Date:
Hello dear developers,

For my application it would be great to be able to increase the
verbosity of the SQLExceptions. I found out that PSQL-Exceptions that
are based on server errors call ServerErrorMessage.toString(), which
itself is configured with a verbosity parameter which equals the
loglevel of the PostgreSQL JDBC Driver. By setting the loglevel to 1
(INFO), the driver prints info to the DriverManager.getLogWriter() in
other occassions, too, which is not exactly what I need. Currently I
solve this dilemma by using the driver option "loglevel=1", and setting
DriverManager's logwriter to a NullPrintStream.

Would it be possible to add an exceptionloglevel option to the driver?
This option would make the driver silent, but the exeptions, which get
commonly printed to logfiles, more verbose.

With best regards,
Daniel Migowski
--

 |¯¯|¯¯|    *IKOffice GmbH             Daniel Migowski*
 |  |  |/|                            Mail: dmigowski@ikoffice.de <mailto:dmigowski@ikoffice.de>
 |  | // |  Nordstr. 10               Tel.: 0441 21 98 89 52
 |  | \\ |  26135 Oldenburg           Fax.: 0441 21 98 89 55
 |__|__|\|  http://www.ikoffice.de    Mob.: 0176 22 31 20 76


Re: Feature Request: PSQLException verbosity option

From
Kris Jurka
Date:

On Fri, 25 Apr 2008, Daniel Migowski wrote:

> For my application it would be great to be able to increase the
> verbosity of the SQLExceptions. I found out that PSQL-Exceptions that
> are based on server errors call ServerErrorMessage.toString(), which
> itself is configured with a verbosity parameter which equals the
> loglevel of the PostgreSQL JDBC Driver. By setting the loglevel to 1
> (INFO), the driver prints info to the DriverManager.getLogWriter() in
> other occassions, too, which is not exactly what I need. Currently I
> solve this dilemma by using the driver option "loglevel=1", and setting
> DriverManager's logwriter to a NullPrintStream.
>
> Would it be possible to add an exceptionloglevel option to the driver?
> This option would make the driver silent, but the exeptions, which get
> commonly printed to logfiles, more verbose.

Maybe we should just increase the default verbosity.  The original idea
was that we didn't want to overwhelm the stacktrace with secondary
information.  Perhaps we should just dump everything we can as it's
obviously useful in these cases.

Kris Jurka

Re: Feature Request: PSQLException verbosity option

From
Daniel Migowski
Date:
Kris Jurka schrieb:
>
>
> On Fri, 25 Apr 2008, Daniel Migowski wrote:
>
>> For my application it would be great to be able to increase the
>> verbosity of the SQLExceptions. I found out that PSQL-Exceptions that
>> are based on server errors call ServerErrorMessage.toString(), which
>> itself is configured with a verbosity parameter which equals the
>> loglevel of the PostgreSQL JDBC Driver. By setting the loglevel to 1
>> (INFO), the driver prints info to the DriverManager.getLogWriter() in
>> other occassions, too, which is not exactly what I need. Currently I
>> solve this dilemma by using the driver option "loglevel=1", and
>> setting DriverManager's logwriter to a NullPrintStream.
>>
>> Would it be possible to add an exceptionloglevel option to the
>> driver? This option would make the driver silent, but the exeptions,
>> which get commonly printed to logfiles, more verbose.
>
> Maybe we should just increase the default verbosity.  The original
> idea was that we didn't want to overwhelm the stacktrace with
> secondary information.  Perhaps we should just dump everything we can
> as it's obviously useful in these cases.
>
> Kris Jurka
>
Sounds great. The only "strange" thing with PostgreSQL-Exceptions will
then be that they have multilined messages, which is AFAIK uncommon, but
not forbidden, in Java, but might eventually break logfile parsers. In
my case i like the multiline exceptions. Another possibility would be to
print all the information into a single line, and work a bit on the
formatting to have this look good.

With best regards,
Daniel Migowski

Re: Feature Request: PSQLException verbosity option

From
Kris Jurka
Date:

On Tue, 20 May 2008, Daniel Migowski wrote:

> Sounds great. The only "strange" thing with PostgreSQL-Exceptions will
> then be that they have multilined messages, which is AFAIK uncommon, but
> not forbidden, in Java, but might eventually break logfile parsers. In
> my case i like the multiline exceptions. Another possibility would be to
> print all the information into a single line, and work a bit on the
> formatting to have this look good.
>

It's a lot of stuff to jam on one line and we already use multiline
exceptions if we have a Detail message, so I've kept it multiline.  I've
added hint, position, and where to the default message.  File, line,
routine, internal_query, and internal_position are still not shown unless
additional verbosity is requested.

Kris Jurka

Re: Feature Request: PSQLException verbosity option

From
Daniel Migowski
Date:
Kris Jurka schrieb:
> On Tue, 20 May 2008, Daniel Migowski wrote:
>> Sounds great. The only "strange" thing with PostgreSQL-Exceptions
>> will then be that they have multilined messages, which is AFAIK
>> uncommon, but not forbidden, in Java, but might eventually break
>> logfile parsers. In my case i like the multiline exceptions. Another
>> possibility would be to print all the information into a single line,
>> and work a bit on the formatting to have this look good.
> It's a lot of stuff to jam on one line and we already use multiline
> exceptions if we have a Detail message, so I've kept it multiline.
> I've added hint, position, and where to the default message.  File,
> line, routine, internal_query, and internal_position are still not
> shown unless additional verbosity is requested.
>
> Kris Jurka
Thanks alot, exactly what i need!

With best regards,
Daniel Migowski