P6Spy is a jdbc driver that wraps a real jdbc driver and iterecepts the calls and logs them. see http://www.p6spy.com/ for more details.