[ https://issues.apache.org/jira/browse/LOG4NET-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14581921#comment-14581921 ]
Gert Kello commented on LOG4NET-178: ------------------------------------ Hi. I can't fully agree with the conclusion. The start and stop events should be executed in different app domains so one should not interfere with another at C# code level. I made a very simple test web site, which produces following output {code} 2015-06-11 15:58:53,514 [5->/LM/W3SVC/1/ROOT/test-1-130785010739331037] - Request nr 37 served 2015-06-11 15:58:54,126 [10->/LM/W3SVC/1/ROOT/test-1-130785010739331037] - Request nr 38 served 2015-06-11 15:58:55,121 [1->/LM/W3SVC/1/ROOT/test-1-130785011348421940] - App started 2015-06-11 15:58:55,165 [5->/LM/W3SVC/1/ROOT/test-1-130785011348421940] - Request nr 1 served 2015-06-11 15:58:55,718 [5->/LM/W3SVC/1/ROOT/test-1-130785011348421940] - Request nr 2 served 2015-06-11 15:58:55,872 [8->/LM/W3SVC/1/ROOT/test-1-130785010739331037] - Shutting down: HostingEnvironment 2015-06-11 15:59:01,605 [5->/LM/W3SVC/1/ROOT/test-1-130785011348421940] - Request nr 3 served {code} where logging pattern is {code} "%date [%thread->%appdomain] - %message%newline" {code} As You can see the app domain names are different for "app start" and "shutting down" messages. And the logging system remained functional after the shut down on LogManager was called Code in global.asax: {code} void Application_Start(object sender, EventArgs e) { log4net.Config.XmlConfigurator.Configure(); log4net.ILog log = log4net.LogManager.GetLogger(this.GetType()); log.Info("App started"); } void Application_End(object sender, EventArgs e) { log4net.ILog log = log4net.LogManager.GetLogger(this.GetType()); log.InfoFormat("Shutting down: {0}", System.Web.Hosting.HostingEnvironment.ShutdownReason); log4net.LogManager.Shutdown(); } {code} Am I missing something in my test? > Log4Net stops logging after appdomain recycle of ASP.NET2.0 application > ----------------------------------------------------------------------- > > Key: LOG4NET-178 > URL: https://issues.apache.org/jira/browse/LOG4NET-178 > Project: Log4net > Issue Type: Bug > Components: Appenders > Affects Versions: 1.2.10 > Environment: Windows server 2003 > Reporter: Richard Nijkamp > Assignee: Dominik Psenner > Fix For: 1.2.12 > > > Dear sir/madam, > We are using Log4Net 1.2.10. We encounter the problem that Log4net doesn't > continue logging after an event that triggers an appdomain recycle/restart. > In the global.asax we start the logging with: > private static readonly ILog log = > LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); > Logging works flawless when the application is started for the first time. > After sometime it might occur that the appdomain gets recycled due to > inactivity of the web application. We use the following code in > Application_end(): > log.Info("*** Application end ***"); > log4net.LogManager.Shutdown(); > After this function the application gets restarted and the > Application_start() method executes and writes new lines to the log. The > problem is that the log4net doesn't write the new lines after the restart. > Could you explain why log4net might stop working after an appdomain restart > of an asp.net2.0 web application? If I want log4net to work properly again I > need to restart IIS manually. > Looking forward to your reply. > Best regards, > Richard Nijkamp -- This message was sent by Atlassian JIRA (v6.3.4#6332)