logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lazy Developer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-178) Log4Net stops logging after appdomain recycle of aps.net2.0 application
Date Mon, 26 Nov 2012 21:06:58 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504094#comment-13504094
] 

Lazy Developer commented on LOG4NET-178:
----------------------------------------

Hi Everyone, 

Thanks the tip from Dominik, he's right, it's completely about CONFIGURATION. 

We turned on the log4net internal logging (log4net.Internal.Debug=true...etc.) for more details.
The root of our problem is about forgetting this code log4net.Config.XmlConfigurator.Configure()
in Global.asax.cs (Application_Start). REMOVE IT!

We have separate log4net.config from web.config and in the AssemblyInfo.cs we've already have
this code [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch =
true)]. It must be enough.

When the recycle occured (Application_Start is activated) the log4net tried to looking for
its configuration in web.config instead of log4net.config (because of the mentioned code log4net.Config.XmlConfigurator.Configure()).
It's certainly failed, therefore stop logging.
                
> 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

Mime
View raw message