Logging log messages from different user session into different log files

270 Views Asked by At

I need to log messages from different user session into different log files. Also roll the log files which are X days old. How can I achieve that? Currently I'm using SLF4j along with Log4j. But I am willing to change my logging framework.

I tried using SLF4j MDC. But it works per thread basis. It looks like the same thread is servicing different user sessions.

Can someone help me with this?

1

There are 1 best solutions below

0
On BEST ANSWER

Finally figured it out. MDC is set per thread. So each time a request is made to the server, we need to set MDC which can be acheived using Servet/Portlet filters.