logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lybarger <mlybar...@gmail.com>
Subject logging http session identifying information
Date Wed, 18 May 2005 12:47:35 GMT
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. 


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 

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 


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message