-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gergely,

Gergely Paljak wrote:
> A want to realize a logging system for tomcat that is capable of:
> - logging the incoming request for Servlets (easy)
> - and logging the time when the Tomcat response is sent (easy as well)

As you say, these are relatively easy to accomplish.

> - logging the outgoing SQL queries inside Tomcat while maintaining a mapping
> between the requested Servlet and the sent SQL queries
> - logging the incoming SQL query results

I think your best bet is to implement your own DataSource that extends
Tomcat's built-in datasource (or some other one, if you like). Have your
DataSource return Connection objects that wrap the ones provided by
Tomcat's DataSource object.

Your Connection class should produce wrapped Statement classes that log
the statements as they are executed, and wrapped ResultSet objects that
do ... something else. Due to the specific JDBC spec requirements about
how results are read, you may have to settle for only reading those
values /actually read/ by the application, instead of the entire result set.

I have implemented JDBC interface wrappers before, and they are
completely miserable to do (just sooo much plumbing code). I wrote a
super-sexy class wrapper generator if you're interested in doing
something like this.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmAplsACgkQ9CaO5/Lv0PAySgCfZSTz2qkBq4yZD3HCuvAYDTBb
2ygAnR3SMz+fR0Ow1rBF+lJcfjm5YJEU
=wTg7
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to