Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top