i want to log the session id, and any other info from the session that i choose so that i can sort my logs per session.
i'll check out the sandbox. On 5/18/05, Mark Womack <[EMAIL PROTECTED]> wrote: > > If I understand correctly, you want to set session/user specific > information > per request? Since the MDC is stored in ThreadLocal, I think you will need > to use a servlet filter to set and unset the MDC for each request. And > yes, > how threads are assigned to handle requests, etc is very container > specific. > So, setting and unsetting the MDC with each request is a good thing. I > cannot remember offhand if there is already an MDC related servlet filter > in > the log4j-sandbox. You might want to take a quick look and use it as an > example. > > -Mark > > ----- Original Message ----- > From: "Mark Lybarger" <[EMAIL PROTECTED]> > To: <log4j-user@logging.apache.org> > Sent: Wednesday, May 18, 2005 5:47 AM > Subject: logging http session identifying information > > > I'm looking for a method to log http session information in our log4j > logging. we want to be able to trace logging to a particular session. For > instance, when a user reports having trouble, we would like to see what > they > did on the web site. > > We have a thread id being logged with each log, but there's no way to tie > the threads together into a session of activity. I've also read that it's > very container specific as to weather or not the same thread is used for > an > entire servlet execution. > > I came across this note on using MDC for logging session information. > > > http://ulc-community.canoo.com/snipsnap/space/Contributions/Integration+Snippets/Log4J+MDC+Integration > > It seems rather easy to extend to support any http session attributes that > i > might want to log (user id, etc). > > Are there other methods to easily log a session id or other information in > our log4j logs? Are there drawbacks to the solution of using the MDC > integration? > > One thing that wasn't very clear with the MDC integration was where to put > the setup code in an servlet container environment. We're using a startup > servlet in all our web apps. Would we need this in each web app's startup > servlet? > > Thanks! > ~mark > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >