logo       

RE: Logging in a Web App (Threads, Sessions and Requests): msg#00037

log.log4net.user

Subject: RE: Logging in a Web App (Threads, Sessions and Requests)

I think you're getting confused with HttpHandlers. There is a member of
the IHttpHandler interface called IsResulable which says:

"
Gets a value indicating whether another request can use the
System.Web.IHttpHandler instance.
"

I believe that each request gets its own HttpModule. That's why
HttpApplication is passed into the Init function. Every request has its
own context. If I put something into request1's context, I don't have
access to that item from request2.

--- "Hart, Leo" <Leo.Hart@xxxxxxx> wrote:

> Oh, I get it now! The "MyAuthenticateRequest" name woke me up.
> Thanks!
>
> A question: what happens in the following situation:
>
> There are two requests on the same thread.
>
> Request1 starts
> log4net.MDC.Set("sessionID", mContext.Session().SessionID) is
> called in my HttpModule
> Some logging for Request1 occurs
> Request2 starts
> log4net.MDC.Set("sessionID", mContext.Session().SessionID) is
> called in my HttpModule
> Some logging for Request2 occurs
> Some logging for Request1 occurs
> Request1 ends
> Request2 ends
>
> Once that second MDC.Set is called, won't all of my logging for
> Request1
> be written with Request2's sessionID? Since a web app is
> multi-threaded, I cannot guarantee that Request1 will finish before
> Request2 application, can I?



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise