Wednesday, February 16, 2011

Keep track of web requests in log files

Especially in integration and staging environments it is useful to have the whole request so when you get notifications about current problems you get a better picture of what actually happened.

You must be careful what you log (exclude any sensitive information like passwords, SSN, even user names) but you must have a utility that allows you to dump the request.

In Servlet programming I have my own class iterating through headers and parameters, sometimes cookies and this time I told myself there must be something in Jakarta Commons or one of the existing frameworks (Spring/Struts). To my surprise this is still not standardized.

Here is a good class that could be used in current frameworks or extensions to them. This helps what I call proactive coding (You fix or at least are aware of problems before you get notified about them)

No comments:

Followers