You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Richard Nijkamp (JIRA)" <ji...@apache.org> on 2008/10/06 10:37:45 UTC

[jira] Created: (LOG4NET-178) Log4Net stops logging after appdomain recycle of aps.net2.0 application

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


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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4NET-178) Log4Net stops logging after appdomain recycle of aps.net2.0 application

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646749#action_12646749 ] 

Ron Grabowski commented on LOG4NET-178:
---------------------------------------

What appenders are you using? Maybe you have an exclusive lock on something that is still being kept after the restart. Have you tried using the AdoNetAppender and/or appending the processid to your filename so every restart gets its own file?

> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4NET-178) Log4Net stops logging after appdomain recycle of aps.net2.0 application

Posted by "Ilpo Juvander (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648323#action_12648323 ] 

Ilpo Juvander commented on LOG4NET-178:
---------------------------------------

We have also similar situation. We're using rollingfileappender.

What has helped on some cases is to call on global.asax Xmlconfigurator.ConfigureAndWatch -method on Init(), but this trick does not work 100% of the time. It just stops logging.

Even restarting IIS does not help. Sometimes logging resumes after renaming the logfile, sometimes not. Same thing happens when adding the processid into it.

Appender in setup like this:

    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="Webservice.service.txt" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="1000KB" />
      <staticLogFileName value="false" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date %-5level %logger (%file:%line) - %message%newline" />
      </layout>
    </appender>

Nothing really helpfull in the log4net debug after 

log4net: Hierarchy: Shutdown called on Hierarchy [log4net-default-repository] 

Xmlconfigurator entires are never shown and logging stopped.

On some systems this does not happen at all, on some places it happens all the time. Took a while before I got it in our test environment, but now it happens in there all the time as well...

> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.