We do something similar. We have implemented a RequestFilter that pushes the
HttpSession ID (if any) onto the Log4j Nested Diagnostics Context (NDC)
before the request, and pops it afterwards.
I guess that the same approach could be used for pushing usernames in the
SLF4J MDC, provided that you can get hold of them from a RequestFilter.

Good to know: Tapestry 5.1 stores @SessionStateObjects in the session under
the key "sso:" + MySessionStateObject.class.getName(). ("aso:" in 5.0.*)

HTH,
Olle

Senior Java Developer and Architect
olle.hal...@crisp.se
www.crisp.se




2009/10/9 Borut Bolčina <borut.bolc...@gmail.com>

> Hello,
>
> has anybody implemented logging with MDC %X{username}?
>
> I would like to track users in my logs by their username and/or IP address.
> Before I dive in, I just wanna ask if someone has already done it?
>
> Thanks, Borut
>

Reply via email to