Creating logs specific to each user session
1 posts in topic
Flat View  Flat View

Posted By:   mythili_santhanam
Posted On:   Wednesday, April 4, 2007 08:16 AM

the requirement is to create logs specific to each user session.
This is the normal logging in a web application
Please let me know the configuration to be done or relevant api methods

Re: Creating logs specific to each user session

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, April 7, 2007 09:21 AM

My first guess is that I think (?) you'll need to put in some initialization code in your servlet doPost/doGet (or Struts Actions etc., wherever you handle requests), which will get a new log4j Appender, with a different name and matching output filename, both based on some info you get from the session (sessionid perhaps, which should be fairly unique?). I don't think (?) you can do this with just the usual static log4j config files.

Also my guess is that you should probably create a new instance of the Appender again each time you re-encounter an existing session... that might be safer than, for instance, trying to save the Appender as a session attribute (where transient state restoration, serializability problems etc. would come).
About | Sitemap | Contact