Aug 13th, 2009, 11:53 AM
Full web request log
I am developing web API-like application. Users do RESTful style requests to my API and I need (that is a requirement) to log every such request into the database, including IP, URL, Request Method (GET/POST/PUT/DELETE), Request Body (XML), Response Body (XML), Date, Response time (how long took the request), Response HTTP status (200, 409, etc.) and SQL queries that have been run during the request.
So most of the information I have already logging into the database using LoggerInterceptor which extends HandlerInterceptorAdapter.
But with SQL queries that have been run during the request I have a litle problem. I use there iBATIS with Spring. And the only way I found (yet) how to intercept the prepared statements and parameters is using custom log4j.appender and parsing all the log data (parsing to get exact queries and parameters) and mapping then that data to the request.
So I want to ask, is there any cleaner/proper/easier way to log SQL queries with each request into the database?
Thanks in advance for any idea, advice.
Dec 3rd, 2011, 03:47 AM
I would also like to do similar thing. but bit confused if i should use filters or interceptors or AOP.
can you provide some detail info on how you are handling it.
If my app is having multiple DispatcherServlets one for spring MVC other for flex clients(blazeds), then I think we need to define interceptors in each DispatcherServlets , In such case filter is good option ?
Last edited by kannanMugundan; Dec 3rd, 2011 at 03:55 AM.
Tags for this Thread