logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fahad Sarwar" <fsar...@opaltelecom.co.uk>
Subject RE: RollingFileAppender Stops logging in Web Service
Date Mon, 12 Dec 2005 16:24:46 GMT
Thanks for yr reply.

The SetConfigurator method is used to tell Log4Net where to find the config
file.  The code is as follows:

public static void SetConfigurator(string configFile)
{
	log4net.Config.DOMConfigurator.Configure( new System.IO.FileInfo(
configFile ) );
}

It uses DOMConfigurator to specify the path to the config file.  This is
called whenever an application starts (otherwise I have found log4net to not
log at all), for example in a WebService I have it referenced in the
Application_Start method, in a Windows Service I have it when the Service is
started, in a Windows Form I have it in the beginning of the Main() method
etc.

Btw I havent referenced log4net.LogManager.Shutdown(); in any of my code.

thanks
Fahad

-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: 12 December 2005 16:11
To: Log4NET User
Subject: Re: RollingFileAppender Stops logging in Web Service

Perhaps there is something wrong in your
Opal.Logging.LogEntry.SetConfigurator method. Can we see the source to that?
My Application_End usually includes a simple message to help my keep track
of when the app domain gets unloaded.

 protected void Application_End(Object sender, EventArgs e)  {
  log.Info("Application ended");
  log4net.LogManager.Shutdown();
 } 

Maybe something isn't automatically be re-initialized when the app domain
gets reloaded...

--- Fahad Sarwar <fsarwar@opaltelecom.co.uk> wrote:

> Hi, I am using Log4Net within a WebService.  I have been successfully 
> logging to a file using the RollingFileAppender, however recently the 
> webservice stops logging completly to the file for no apparant reason.  
> The WebService continues to work successfully but no logs are 
> generated.
> I have
> read in other threads that by touching the web.config file, this will 
> cause the webservice to start logging again.  This works fine, but 
> again, sometimes a week later or a month later, the WebService stops 
> logging.
>  
> Has anyone come across this problem in the past as i have not seen 
> anything on the forum.
>  
> Below is a sample of the web.config used.
>  
> <?xml version="1.0" encoding="utf-8" ?> <configuration>  
> <configSections>
>   <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />  
> </configSections> <appSettings> ....
> </appSettings>
>  
>  
> <log4net>
>   <appender name="RollingFileAppender"
> type="log4net.Appender.RollingFileAppender">
>    <param name="File"
>
value="C:\\logs\\NGSPublicMobilePrePayProvisioningService\\NGSPublicMobilePr
> ePayLog" />
>    <param name="AppendToFile" value="true" />
>    <param name="RollingStyle" value="Date" />
>    <!--<param name="MaxSizeRollBackups" value="10" />-->
>    <param name="DatePattern" value="yyyyMMdd" />
>    <param name="StaticLogFileName" value="false" />
>    <layout type="log4net.Layout.PatternLayout">
>     <param name="ConversionPattern" value="%d - %m%n" />
>    </layout>
>   </appender>
>  
>   
>   <appender name="OpalLoggingAppender"
> type="log4net.Appender.OpalLoggingAppender" >
>    <param name="threshold" value="FATAL" />
>   </appender>
>   
>   <root>
>             <level value="INFO" />
>             <appender-ref ref="OpalLoggingAppender" />
>             <appender-ref ref="RollingFileAppender" />
>         </root>
>   </log4net>
>     
> </configuration>
>  
> Within my Global.asax file i use the following line of code, which
> basically
> tells the log4net where to find the web.config:
>  
> protected void Application_Start(Object sender, EventArgs e)
> 
> {
>
Opal.Logging.LogEntry.SetConfigurator(AppDomain.CurrentDomain.SetupInformati
> on.ConfigurationFile); }
> 
>  
>  
> 
> Fahad Sarwar
> 
> Opal Telecom
> 
> Applications Team
> 
> Irlam
> 
> Tel: +44 161 222 2145
> 
> Fax: +44 161 222 2008
> 
> Email: fsarwar@opaltelecom.co.uk 
> 
>  
> 
> This communication together with any attachments transmitted with it
> ("this
> E-Mail") is intended only for the use of the addressee and may
> contain
> information which is privileged and confidential. If the reader of
> this
> E-Mail is not the intended recipient or the employee or agent
> responsible
> for delivering it to the intended recipient you are hereby notified
> that any
> use, dissemination, forwarding, printing or copying of this E-Mail is
> strictly prohibited. Addressees should check this E-mail for viruses.
> The
> Company makes no representations as regards the absence of viruses in
> this
> E-Mail. If you have received this E-Mail in error please notify our
> IT
> Support Team immediately by telephone on 0845 456 9100 or via e-mail
> at
> support@opaltelecom.co.uk Please then immediately delete, erase or
> otherwise
> destroy this E-Mail and any copies of it.
> 
> Any opinions expressed in this E-Mail are those of the author and do
> not
> necessarily constitute the views of the Company. Nothing in this
> E-Mail
> shall bind the Company in any contract or obligation.
> 
> For the purposes of this E-Mail "the Company" means Opal Telecom Ltd.
> Please feel free to visit our website: 
> <http://www.opaltelecom.co.uk/>
> www.opaltelecom.co.uk
> 
> Opal Telecom Ltd (Registered in England & Wales No. 3849133) 
> 
> Brinell Drive, Northbank Industrial Park, Irlam, Manchester M44 5BL.
> 
> A member of the Carphone Warehouse Group of Companies
> 
>  
> 


Mime
View raw message