Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top