Logging multiple users of a web application

Hi all,

I'm looking for some logging advice here.

We have a system where we want to log the actions of multiple users of a web application - basically, each session should have its own log file.

This is currently implemented using log4j. We're actually using JSF, and we have a PhaseListener that monitors what page was just visited, and writes that information to a log file. That log file was initialized so that it writes to a file named after the session ID.

The actual Logger object is created as a member variable of the PhaseListener, and in ideal circumstances should die along with the listener when the session is ended or times out. However, due to the way log4j works, our Logger object is obviously just a reference to one of many potential objects being tracked by the overall LogManager.

So my question is basically this. How can we ensure any session-specific loggers are destroyed at the end of session? If the user manually ends the session, we can probably deal with it, but not with expired/timed out sessions. Surely the logger will continue to exist in memory?

I'm not necessarily looking for code examples - just thoughts and opinions on possible solutions or even comments on whether or not we're barking up the wrong tree...

Thanks

[1309 byte] By [iainmilnea] at [2007-11-27 6:09:03]
# 1
You may find the interfaces javax.servlet.http.HttpSessionListener or javax.servlet.http.HttpSessionBindingListener useful.
BalusCa at 2007-7-12 17:12:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...