I am currently logging sql from hibernate using p6spy in order to get the full sql with the parameters in it so it can be copied and pasted easier for debugging. However I want to log only when the database has an error. Is there anyway to achieve this while still maintaining the SQL with the parameters still in it using p6spy or a different tool. to be clear when I say still in it I mean, for example, that instead of saying SELECT * from employee where employee.id = ? it would say SELECT * from employee where employee.id = 28.
Asked
Active
Viewed 133 times
1
-
Parameters get substituted *server-side*. So usually what you do is log the statement as something like `SELECT ... WHERE employee.id = ?; parameters=(28)`. – Craig Ringer Jun 21 '14 at 03:57
-
2P6Spy does not currently have an option to log only when a SQLException occurs. You could submit a feature request at https://github.com/p6spy/p6spy/issues. – quintonm Jun 21 '14 at 17:07