views:

70

answers:

1

This is going to be a quite broad question, and any suggestions, examples, links are very welcome!

I'm looking for a good way to log my users session, and actions on the site up to a certain point.

The site in question is a site for doing bookings. The users start with doing a search, doing a few steps of data gathering and selections and end up with a booking.

So what I need to implement is some kind of logging of the current session variables at each step the user takes. And perhaps some other valid information. Logging should preferably be done to the a database.

At the end i would like to associate all these session with a booking reference. The goal is to later if something goes wrong with the booking or we need to investigate a situation have all information we need.

I understand log4net is a popular choice for logging, and used it a bit myself for simple purposes, but can not find any good examples regarding my situation.

This should be a common situation, i'm curious how others do it.

+1  A: 

The way I've set this up sometime is to create two tables. One holds a row per session, with some session data (id, timestamp, ip, username (if any), other stuff) and a session_data table with a few rows per session, each row containing a sessionid (referencing the sessions table). a key (describing what is logged, like 'entryform', 'searchform', or 'orderform') and a XML field containing the serialized session state object.

Insert a row in the session table using global.asa's session_onstart. Insert rows in session_data as needed.

I used simple stored procedures, but I gather you can setup log4net to insert the row. One caveat: I did setup nlog one time to log the sessions and session data, but nlog (and I suppose log4net as well) logs on its on thread and does't always write to the database. I switched away from nlog for storing the critical session data (but used it for all other debug/logging/tracing purposes)

edosoft
Thank you for your suggestions. This is definitely a good way to do it, but i was rather hoping for a already complete tool, it it exists any.. Something that takes care of all that insertions of session data, and a way to view it in a good way.
Johan Wikström
[note to the UI: we need more separation between 'Add Comment' vs 'Add Answer'] >> Looking for pretty much the same - you'd think such a tool would exist - The tools to create that tool are out there...logparser could be the foundation for some really interesting developer utilties - think firebug for IIS7.<<
justSteve