Right... that's been working well for us. I have a request listener method in a POJO:

import org.apache.log4j.MDC;

public class EventListener implements ServletRequestListener // among others
{
   public void requestInitialized(ServletRequestEvent sre) {
HttpServletRequest req = (HttpServletRequest) sre.getServletRequest();
       HttpSession session = req.getSession();
       if (session != null) {
// Get the userName stored in session at login. String userName = (String) session.getAttribute(USERNAME_KEY);
           MDC.put("user", userName);
       }
   }
}

Then my log4j configuration has a ConversionPattern:
      "... (%X{user}) ..."



Jérôme BERNARD wrote:
I guess, you are speaking of the MDC (Mapped Diagnostic Context)
feature in log4j.
This is somehow a j.u.Map context that can be used in log statements.
You are the one responsible for correction populating the context map.

Regards,
Jérôme.

On 9/6/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
I know one of the logging packages has a feature that allows you to bind
logging output to a particular user associated with a particular servlet
session. I'd probably go that route. The syntax in the logger involved
something along the lines of "%u" I think.

On 9/6/06, Henri Dupre <[EMAIL PROTECTED]> wrote:
>
> I'm experiencing some strange bugs and I can't figure out how our
> customers
> browsing our website cause these problems.
>
> How could I trace the actions people do on the website in order to be able
> to reproduce them? (and also without killing the log files)
>
> --
> Henri Dupre
> Actualis Center
>
>


--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to