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).