I need to log all PreparedStatements in my application. So far I’ve done logging of chosen queries by hand, but I have hundreds of them and adding logging for them would be a terrible job to do. Any suggestions?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you’re using plain JDBC, not any ORM, since it’s a different story then.
There’s a library called log4jdbc, it’s sufficient to add it to your classpath and add it to your JDBC URL just after “jdbc”:
and change your driver class to: