flysa / log4jdbc

Automatically exported from code.google.com/p/log4jdbc
0 stars 0 forks source link

Can we log JDBC warnings as well? #62

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm in process of debugging some triggers.

During this process, I've setup a series of "RAISE NOTICE" (PostgreSQL 
statement) that is captured by JDBC driver as SQLWarning.

No logger so far is able to capture SQLWarnings after statement execution.

Would be possible to add this feature to log4jdbc?

I would like to capture the SQL Statement (prepared or not) that resulted in a 
SQLWarning from database.

Thanks,

Edson

Original issue reported on code.google.com by brvik...@gmail.com on 16 Jan 2013 at 11:26

GoogleCodeExporter commented 8 years ago
I don't know how the driver could do that without calling getWarnings after 
every call which would be very inefficient. Do you know of any other way to do 
it?

Original comment by arthur.b...@gmail.com on 17 Jan 2013 at 1:23

GoogleCodeExporter commented 8 years ago
Unfortunately, not.
If there are no warnings, the call to getWarnings is supposed to return null; 
At other side, if getWarnings() return non null value, it is necessary to call 
nextWarning in the SQLWarning object until it returns null.

I know it would be very expensive - but this is for debugging server side 
conditions only, never to keep in test or production systems.

Regards,

Edson

Original comment by brvik...@gmail.com on 17 Jan 2013 at 1:33

GoogleCodeExporter commented 8 years ago
Seems like that could work. Did you try it?

Original comment by arthur.b...@gmail.com on 17 Jan 2013 at 8:47

GoogleCodeExporter commented 8 years ago
No, I've not.
My project works with JPA, and I don't have access to the underlining 
statements. That's why I was looking for the log solution  log4jdbc.

Original comment by brvik...@gmail.com on 17 Jan 2013 at 9:35

GoogleCodeExporter commented 8 years ago
I meant did you modify log4jdbc to log the warnings and see if that worked?

Original comment by arthur.b...@gmail.com on 17 Jan 2013 at 9:40

GoogleCodeExporter commented 8 years ago
No, I've not. I'll give a try as soon as I get some spare time to understand 
the architecture and give some small steps into the code.

I was hoping that some configuration related to Warnings was able to do that 
already.

Right now, I need to finish these triggers.

Regards,

Edson

Original comment by brvik...@gmail.com on 17 Jan 2013 at 9:46