Return-Path: X-Original-To: apmail-logging-log4net-dev-archive@www.apache.org Delivered-To: apmail-logging-log4net-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 57B05D79E for ; Sat, 27 Oct 2012 13:49:58 +0000 (UTC) Received: (qmail 3157 invoked by uid 500); 27 Oct 2012 13:49:58 -0000 Delivered-To: apmail-logging-log4net-dev-archive@logging.apache.org Received: (qmail 2907 invoked by uid 500); 27 Oct 2012 13:49:53 -0000 Mailing-List: contact log4net-dev-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET Dev" List-Id: Delivered-To: mailing list log4net-dev@logging.apache.org Received: (qmail 2866 invoked by uid 99); 27 Oct 2012 13:49:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Oct 2012 13:49:51 +0000 X-ASF-Spam-Status: No, hits=1.0 required=5.0 tests=DEAR_SOMETHING,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dpsenner@gmail.com designates 74.125.83.47 as permitted sender) Received: from [74.125.83.47] (HELO mail-ee0-f47.google.com) (74.125.83.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Oct 2012 13:49:45 +0000 Received: by mail-ee0-f47.google.com with SMTP id t10so1562429eei.34 for ; Sat, 27 Oct 2012 06:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7ABvsYbnRl6VUBn9BiDZMIUlG87ILjKEXRyOTfgli1s=; b=IDg+CoZTK3Eijkj9gns4DmBEUEmMH9LY0wDwUeHIEVsSuMQ+WEhvLP6ALVsRy260Lr FLsaAwKbJ4WjteMkQgTHXkAki7gE+XvxIPL8PXF5klGreZ/A+J0jXsW+QLEFTJfT+juS AJlYXbaWFFserHezRvAy/ZhZT30DUxlup+wgzDlRFgBeA7w9W20YA0GAAE4fOaHgsSDO 8KoCZxvHSjCWqhH1QNZOWs2TEs2HzOIJ02nGdmXqDHO8YYeisP/foX6Yysobt0uE3jRR J0J9Mv0USxteOfJAohPo6ZBXphoKQ36sDs3akJl2MGpg4x6VfY53KX299cOAINtjro7U vD0g== MIME-Version: 1.0 Received: by 10.14.194.2 with SMTP id l2mr42946925een.12.1351345765118; Sat, 27 Oct 2012 06:49:25 -0700 (PDT) Received: by 10.14.205.72 with HTTP; Sat, 27 Oct 2012 06:49:25 -0700 (PDT) In-Reply-To: References: <1181111352.31085.1351233912993.JavaMail.jiratomcat@arcas> Date: Sat, 27 Oct 2012 15:49:25 +0200 Message-ID: Subject: Re: [jira] [Commented] (LOG4NET-178) Log4Net stops logging after appdomain recycle of aps.net2.0 application From: Dominik Psenner To: Log4NET Dev Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi George, would You please post this in JIRA so that others that watch the issue get an update too? It may become helpful for whoever runs into similar problems and could actually lead to resolve LOG4NET-178 once and for all. Cheers, Dominik 2012/10/26 George Chung : > OK, I don't do anything special that I do in my code except set the AppName. > > Here's what you'll want to do. > > Set this in your Web.Config > > > > > If this setting is false, which is the default, log4net will silently > swallow any exceptions before returning to your code. If it's set to true, > then log4net still swallows the exceptions, but reports them. If you run > your ASP.NET app in the debugger and you have configured a TraceAppender, > you'll see log4net output in the Output window. While still in the debugger, > touch your web.config, thus forcing the AppDomain to reload the app. Note, > you'll still be in the debugger. Visit a page hosted by your ASP.NET app to > cause your Application_Startup() to execute. Execute something that you know > will trigger a log4net log event. At this point, if log4net is having > problems, you'll see gobs of log4net output in the Output window. > > I used this technique to figure out why my ASP.NET app was not logging in > release mode. Well, it's because I configured log4net to capture line > numbers. Well, line numbers don't exist in release builds. By using the > above technique, I was able to see that I was getting an exception trying to > insert an empty string into an integer column in my configured > AdoNetAppender. > > On Fri, Oct 26, 2012 at 12:34 PM, George Chung wrote: >> >> I know I explicitly initialize some log4net setting in >> Application_Startup. Let me look it up. >> >> >> On Thu, Oct 25, 2012 at 11:45 PM, Dominik Psenner (JIRA) >> wrote: >>> >>> >>> [ >>> https://issues.apache.org/jira/browse/LOG4NET-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484745#comment-13484745 >>> ] >>> >>> Dominik Psenner commented on LOG4NET-178: >>> ----------------------------------------- >>> >>> I am no expert on IIS web applications, but it would look like a >>> misconfigured log4net configuration and/or a missing initialization. If >>> logging starts by changing the web.config, log4net is "watching" for changes >>> in the web.config and respawns the appenders when that happens. This means >>> that either: >>> >>> * log4net gets never started >>> * log4net gets stopped and not restarted >>> >>> Thus - in theory - adding an initialization in the right spot alike the >>> one in comment >>> https://issues.apache.org/jira/browse/LOG4NET-178?focusedCommentId=13127649&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13127649 >>> could fix the issue. >>> >>> > Log4Net stops logging after appdomain recycle of aps.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 >>> > Fix For: 1.2 Maintenance Release >>> > >>> > >>> > 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 is automatically generated by JIRA. >>> If you think it was sent incorrectly, please contact your JIRA >>> administrators >>> For more information on JIRA, see: http://www.atlassian.com/software/jira >> >> > -- Dominik Psenner ## OpenPGP Key Signature ################################# # Key ID: B469318C # # Fingerprint: 558641995F7EC2D251354C3A49C7E3D1B469318C # ##########################################################