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 <geo...@glympse.com>:
> 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
>
>   <appSettings>
>     <add key="log4net.Internal.Debug" value="true"/>
>
> 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 <geo...@glympse.com> 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) <j...@apache.org>
>> 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  #
##########################################################

Reply via email to