logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "刘志军" <liuzhijun...@gmail.com>
Subject Re: Log4Net Can Not Log Message When AppDomain Unload , Why?
Date Tue, 29 May 2007 10:19:24 GMT
Dear All,

Very Very Thanks To:

Erich Eichinger <E.Eichinger@diamonddogs.cc>
Ron Grabowski <rongrabowski@yahoo.com>

My "Problem" has been fixed !

Very Thanks!

If I have other problem i will come here again.See everybody!~

On 5/29/07, Erich Eichinger <E.Eichinger@diamonddogs.cc> wrote:
>
>  Hi,
>
> Ron is right for sure. Session_End is fired asynchronously on a separate
> thread in case of a session-timeout. In this case a special HttpApplication
> instance is constructed to process the Session_End event.
>
> In short: Instead of accessing HttpContext.Current.Session in your
> Session_End() eventhandler, you should write
>
>         protected void Session_End(Object sender, EventArgs e)
>
>           {
>
>             XXXXXX.CommonUtil.Log("Session_End:"+ this.Session.SessionID);
> // note "this.Session" instead of "HttpContext.Current.Session" !
>
>           }
>
> and everything should work as you expect.
>
> hope this helps,
> Erich
>
>  ------------------------------
> *From:* 刘志军 [mailto:liuzhijunabc@gmail.com]
> *Sent:* Tuesday, May 29, 2007 7:05 AM
> *To:* Log4NET User
> *Subject:* Re: Log4Net Can Not Log Message When AppDomain Unload , Why?
>
> Perhaps you are right.
> But I know the httpcontent was build every time whena request is comming.
> when the Session_End fired , why the log component can not work propertyly
> ?
>
>
>
> On 5/29/07, Ron Grabowski <rongrabowski@yahoo.com> wrote:
> >
> > I bet HttpContext.Current is null. If a user closes their browser their
> > session is still active on the server (usually for 20 minutes). When the
> > Session_End event fires there is no HttpContext.Current (i.e. there
> > isn't a Request or a Response).
> >
> >
> >
> > ----- Original Message ----
> >
> > From: 刘志军 <liuzhijunabc@gmail.com>
> >
> > To: log4net-user@logging.apache.org
> >
> > Sent: Monday, May 28, 2007 10:19:21 PM
> >
> > Subject: Log4Net Can Not Log Message When AppDomain Unload , Why?
> >
> >
> >
> > Hi everyone,
> >
> >
> >
> > Details:
> >
> >
> >
> > I used Log4Net for Asp.Net Application under version 1.1.4322.
> >
> >
> >
> >   I want to log the Session_End event in the Global Class by the command
> > line "iisreset".
> >
> >
> >
> > but the infomation can not be loged.
> >
> >
> >
> > In the another , the Session_Start event information can be loged
> > correctly.
> >
> >
> >
> > below is the code:
> >
> >
> >
> > using System;
> >
> > using System.Collections;
> >
> >   using System.ComponentModel;
> >
> > using System.Web;
> >
> > using  System.Web.SessionState;
> >
> >
> >
> > namespace XXXX.XXXX.Web
> >
> >   {
> >
> >     /// <summary>
> >
> >     /// Summary description for Global.
> >
> >     /// </summary>
> >
> >     public class Global :  System.Web.HttpApplication
> >
> >     {
> >
> >         /// <summary>
> >
> >           /// Required designer variable.
> >
> >         /// </summary>
> >
> >           private System.ComponentModel.IContainer components = null;
> >
> >
> >
> >           public Global()
> >
> >         {
> >
> >             InitializeComponent();
> >
> >         }
> >
> >
> >
> >           protected void Application_Start(Object sender, EventArgs e)
> >
> >         {
> >
> >
> >
> >         }
> >
> >
> >
> >           protected void Session_Start(Object sender, EventArgs e)
> >
> >         {
> >
> >               XXXXXX.CommonUtil.Log
> > ("Session_Start:"+HttpContext.Current.Session.SessionID);
> >
> >         }
> >
> >
> >
> >         protected void Application_BeginRequest(Object sender, EventArgs
> > e)
> >
> >           {
> >
> >         }
> >
> >
> >
> >           protected void Application_EndRequest(Object sender, EventArgs
> > e)
> >
> >         {
> >
> >           }
> >
> >
> >
> >         protected void Application_AuthenticateRequest(Object sender,
> > EventArgs e)
> >
> >         {
> >
> >
> >
> >         }
> >
> >
> >
> >         protected void Application_Error(Object sender, EventArgs e)
> >
> >           {
> >
> >
> >
> >         }
> >
> >
> >
> >         protected void Session_End(Object sender, EventArgs e)
> >
> >           {
> >
> >             XXXXXX.CommonUtil.Log
> > ("Session_End:"+HttpContext.Current.Session.SessionID);
> >
> >           }
> >
> >
> >
> >         protected void Application_End(Object sender, EventArgs e)
> >
> >         {
> >
> >
> >
> >         }
> >
> >
> >
> >         #region Web Form Designer generated code
> >
> >         /// <summary>
> >
> >         /// Required method for Designer support - do not modify
> >
> >         /// the contents of this method with the code editor.
> >
> >           /// </summary>
> >
> >         private void InitializeComponent()
> >
> >           {
> >
> >             this.components = new System.ComponentModel.Container ();
> >
> >           }
> >
> >         #endregion
> >
> >     }
> >
> >   }
> >
> >
> >
> >
> >
> >
> >
> > Can some one give me some help ?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
Mime
View raw message