In this case he should use both the MDC and a Session id logger.
The MDC session id is used to track the start session id (from the
start of the request), and the other for comparison during the
request.
It is one of the things I'd like to propose for Wicket NG: to set the
MDC with session id and possibly request ID. This could replace the
request logger IMO (which I like, but I'm always ears to make our API
tighter).
Martijn
On 4/8/08, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> hm, slf4j supports MDC. dont know if it emulates it for logging impls
> that dont support it or not.
>
> here we use logback and have a thing like this:
>
> public class RequestIdLogFilter implements Filter
> {
> private static final String MDC_REQUEST_ID = "requestId";
> private static AtomicInteger requestIdCounter = new AtomicInteger();
>
> public void init(FilterConfig filterConfig) throws ServletException
> {
> requestIdCounter.set(1000);
> }
>
> public void doFilter(ServletRequest request, ServletResponse
> response, FilterChain chain)
> throws IOException, ServletException
> {
> int id = requestIdCounter.getAndIncrement();
> MDC.put(MDC_REQUEST_ID, String.valueOf(id));
> try
> {
> chain.doFilter(request, response);
> }
> finally
> {
> MDC.remove(MDC_REQUEST_ID);
> }
> }
> }
>
> then in the log simply ${requestId} and it adds it to every logging line
>
>
> -igor
>
>
>
> On Mon, Apr 7, 2008 at 4:01 PM, Martijn Dashorst
> <[EMAIL PROTECTED]> wrote:
> > What kind of logging system do you use? log4j's pattern logger has %p
> > I think. If you combine this with start/end logging of your request
> > (see requestcycle#onbeginrequest/onendrequest) you can log the session
> > id together with the username. This would make it easier to track what
> > is happening in each thread.
> >
> > Martijn
> >
> >
> >
> > On 4/8/08, Edvin Syse <[EMAIL PROTECTED]> wrote:
> > > Martijn Dashorst wrote:
> > >
> > > > Add to that the thread name. This way you can track session usage
> > > > across threads.
> > > >
> > >
> > > How do I get the thread name?
> > >
> > >
> > > -- Edvin
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.2 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
> >
> > ---------------------------------------------------------------------
> >
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.2 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]