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]