log4jdbc
log4jdbc copied to clipboard
Can we log JDBC warnings as well?
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 [email protected]
on 16 Jan 2013 at 11:26
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 [email protected]
on 17 Jan 2013 at 1:23
- Added labels: Priority-Low, Type-Enhancement
- Removed labels: Priority-Medium, Type-Defect
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 [email protected]
on 17 Jan 2013 at 1:33
- Added labels: ****
- Removed labels: ****
Seems like that could work. Did you try it?
Original comment by [email protected]
on 17 Jan 2013 at 8:47
- Added labels: ****
- Removed labels: ****
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 [email protected]
on 17 Jan 2013 at 9:35
- Added labels: ****
- Removed labels: ****
I meant did you modify log4jdbc to log the warnings and see if that worked?
Original comment by [email protected]
on 17 Jan 2013 at 9:40
- Added labels: ****
- Removed labels: ****
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 [email protected]
on 17 Jan 2013 at 9:46
- Added labels: ****
- Removed labels: ****