You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by 刘志军 <li...@gmail.com> on 2007/05/29 04:19:21 UTC

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 ?