You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Fahad Sarwar <fs...@opaltelecom.co.uk> on 2005/12/12 14:26:20 UTC
RollingFileAppender Stops logging in Web Service
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
RE: RollingFileAppender Stops logging in Web Service
Posted by Ron Grabowski <ro...@yahoo.com>.
The log4net.txt file was meant to help you track down problems after
the application has been running for a while. If you let you
application run for a few days or weeks and the RollingFileAppender
fails, there's a good chance the log4net.txt file will tell you what's
going wrong.
--- Fahad Sarwar <fs...@opaltelecom.co.uk> wrote:
> I have been using 1.2.0 Beta8 version ( or version 1:2:0:30714 ). I
> tried
> running that system.diagnostics which produced the following log,
> which
> didn't really help using the config file detailed in previous email.
>
> log4net: log4net assembly [log4net, Version=1.2.0.30714,
> Culture=neutral,
> PublicKeyToken=8887c5ebc944b89e]. Loaded from [Global Assembly
> Cache]. (.NET
> Runtime [1.1.4322.2032] on Microsoft Windows NT 5.1.2600.0)
> log4net: DefaultRepositorySelector: defaultRepositoryType
> [log4net.Repository.Hierarchy.Hierarchy]
> log4net: DefaultRepositorySelector: Creating repository for assembly
> [Opal.Logging, Version=2.0.2.0, Culture=neutral,
> PublicKeyToken=1701101df9f38588]
> log4net: DefaultRepositorySelector: Assembly [Opal.Logging,
> Version=2.0.2.0,
> Culture=neutral, PublicKeyToken=1701101df9f38588] Loaded From [Global
> Assembly Cache]
> log4net: DefaultRepositorySelector: Assembly [Opal.Logging,
> Version=2.0.2.0,
> Culture=neutral, PublicKeyToken=1701101df9f38588] does not have a
> DomainAttribute specified.
> log4net: DefaultRepositorySelector: Assembly [Opal.Logging,
> Version=2.0.2.0,
> Culture=neutral, PublicKeyToken=1701101df9f38588] using domain
> [log4net-default-domain] and repository type
> [log4net.Repository.Hierarchy.Hierarchy]
> log4net: DefaultRepositorySelector: Creating repository for domain
> [log4net-default-domain] using type
> [log4net.Repository.Hierarchy.Hierarchy]
> log4net: DOMConfigurator: configuring repository
> [log4net-default-domain]
> using file
>
[C:/NGS/NGSPublicMobilePrePayProvisioningService/WebServiceProjects/MobilePr
> ePayProvisioning/web.config]
> log4net: DOMConfigurator: configuring repository
> [log4net-default-domain]
> using stream
> log4net: DOMConfigurator: loading XML configuration
> log4net: DOMConfigurator: Configuring Repository
> [log4net-default-domain]
> log4net: DOMConfigurator: Configuration update mode [Merge].
> log4net: DOMConfigurator: Logger [root] Level string is [INFO].
> log4net: DOMConfigurator: Logger [root] level set to
> [name="INFO",value=40000].
> log4net: DOMConfigurator: Loading Appender [OpalLoggingAppender]
> type:
> [log4net.Appender.OpalLoggingAppender]
> log4net: DOMConfigurator: Setting Property [Threshold] to Level value
> [FATAL]
> log4net: DOMConfigurator: Created Appender [OpalLoggingAppender]
> log4net: DOMConfigurator: Adding appender named [OpalLoggingAppender]
> to
> logger [root].
> log4net: DOMConfigurator: Loading Appender [RollingFileAppender]
> type:
> [log4net.Appender.RollingFileAppender]
> log4net: DOMConfigurator: Setting Property [File] to String value
>
[C:\logs\NGSPublicMobilePrePayProvisioningService\NGSPublicMobilePrePayLog]
> log4net: DOMConfigurator: Setting Property [AppendToFile] to Boolean
> value
> [True]
> log4net: DOMConfigurator: Setting Property [RollingStyle] to
> RollingMode
> value [Date]
> log4net: DOMConfigurator: Setting Property [DatePattern] to String
> value
> [yyyyMMdd]
> log4net: DOMConfigurator: Setting Property [StaticLogFileName] to
> Boolean
> value [False]
> log4net: DOMConfigurator: Setting Property [ConversionPattern] to
> String
> value [%d - %m%n]
> log4net: DOMConfigurator: Setting Property [Layout] to object
> [log4net.Layout.PatternLayout]
> log4net: RollingFileAppender: Type = [0], r0 = [19700101], r1 =
> [19700101]
> log4net: RollingFileAppender: Type = [1], r0 = [19700101], r1 =
> [19700101]
> log4net: RollingFileAppender: Type = [2], r0 = [19700101], r1 =
> [19700101]
> log4net: RollingFileAppender: Type = [3], r0 = [19700101], r1 =
> [19700102]
> log4net: RollingFileAppender: Searching for existing files in
> [C:\logs\NGSPublicMobilePrePayProvisioningService]
> log4net: RollingFileAppender: curSizeRollBackups starts at [0]
> log4net: FileAppender: Opening file for writing
>
[C:\logs\NGSPublicMobilePrePayProvisioningService\NGSPublicMobilePrePayLog20
> 051212] append [True]
> log4net: DOMConfigurator: Created Appender [RollingFileAppender]
> log4net: DOMConfigurator: Adding appender named [RollingFileAppender]
> to
> logger [root].
> log4net: DOMConfigurator: Hierarchy Threshold []
>
> The main reason for using the RollingFileAppender was that our
> webservices
> generate log files of 20MB a day, and it was just cleaner to use
> RollingFileAppender as it would generate a new file everyday. Do you
> what
> kind of errors have caused by the RollingFileAppender? If things have
> been
> fixed for next release then maybe switching to log4net 1.2.9 maybe
> better.
>
> Fahad
RE: RollingFileAppender Stops logging in Web Service
Posted by Fahad Sarwar <fs...@opaltelecom.co.uk>.
I have been using 1.2.0 Beta8 version ( or version 1:2:0:30714 ). I tried
running that system.diagnostics which produced the following log, which
didn't really help using the config file detailed in previous email.
log4net: log4net assembly [log4net, Version=1.2.0.30714, Culture=neutral,
PublicKeyToken=8887c5ebc944b89e]. Loaded from [Global Assembly Cache]. (.NET
Runtime [1.1.4322.2032] on Microsoft Windows NT 5.1.2600.0)
log4net: DefaultRepositorySelector: defaultRepositoryType
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for assembly
[Opal.Logging, Version=2.0.2.0, Culture=neutral,
PublicKeyToken=1701101df9f38588]
log4net: DefaultRepositorySelector: Assembly [Opal.Logging, Version=2.0.2.0,
Culture=neutral, PublicKeyToken=1701101df9f38588] Loaded From [Global
Assembly Cache]
log4net: DefaultRepositorySelector: Assembly [Opal.Logging, Version=2.0.2.0,
Culture=neutral, PublicKeyToken=1701101df9f38588] does not have a
DomainAttribute specified.
log4net: DefaultRepositorySelector: Assembly [Opal.Logging, Version=2.0.2.0,
Culture=neutral, PublicKeyToken=1701101df9f38588] using domain
[log4net-default-domain] and repository type
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for domain
[log4net-default-domain] using type [log4net.Repository.Hierarchy.Hierarchy]
log4net: DOMConfigurator: configuring repository [log4net-default-domain]
using file
[C:/NGS/NGSPublicMobilePrePayProvisioningService/WebServiceProjects/MobilePr
ePayProvisioning/web.config]
log4net: DOMConfigurator: configuring repository [log4net-default-domain]
using stream
log4net: DOMConfigurator: loading XML configuration
log4net: DOMConfigurator: Configuring Repository [log4net-default-domain]
log4net: DOMConfigurator: Configuration update mode [Merge].
log4net: DOMConfigurator: Logger [root] Level string is [INFO].
log4net: DOMConfigurator: Logger [root] level set to
[name="INFO",value=40000].
log4net: DOMConfigurator: Loading Appender [OpalLoggingAppender] type:
[log4net.Appender.OpalLoggingAppender]
log4net: DOMConfigurator: Setting Property [Threshold] to Level value
[FATAL]
log4net: DOMConfigurator: Created Appender [OpalLoggingAppender]
log4net: DOMConfigurator: Adding appender named [OpalLoggingAppender] to
logger [root].
log4net: DOMConfigurator: Loading Appender [RollingFileAppender] type:
[log4net.Appender.RollingFileAppender]
log4net: DOMConfigurator: Setting Property [File] to String value
[C:\logs\NGSPublicMobilePrePayProvisioningService\NGSPublicMobilePrePayLog]
log4net: DOMConfigurator: Setting Property [AppendToFile] to Boolean value
[True]
log4net: DOMConfigurator: Setting Property [RollingStyle] to RollingMode
value [Date]
log4net: DOMConfigurator: Setting Property [DatePattern] to String value
[yyyyMMdd]
log4net: DOMConfigurator: Setting Property [StaticLogFileName] to Boolean
value [False]
log4net: DOMConfigurator: Setting Property [ConversionPattern] to String
value [%d - %m%n]
log4net: DOMConfigurator: Setting Property [Layout] to object
[log4net.Layout.PatternLayout]
log4net: RollingFileAppender: Type = [0], r0 = [19700101], r1 = [19700101]
log4net: RollingFileAppender: Type = [1], r0 = [19700101], r1 = [19700101]
log4net: RollingFileAppender: Type = [2], r0 = [19700101], r1 = [19700101]
log4net: RollingFileAppender: Type = [3], r0 = [19700101], r1 = [19700102]
log4net: RollingFileAppender: Searching for existing files in
[C:\logs\NGSPublicMobilePrePayProvisioningService]
log4net: RollingFileAppender: curSizeRollBackups starts at [0]
log4net: FileAppender: Opening file for writing
[C:\logs\NGSPublicMobilePrePayProvisioningService\NGSPublicMobilePrePayLog20
051212] append [True]
log4net: DOMConfigurator: Created Appender [RollingFileAppender]
log4net: DOMConfigurator: Adding appender named [RollingFileAppender] to
logger [root].
log4net: DOMConfigurator: Hierarchy Threshold []
The main reason for using the RollingFileAppender was that our webservices
generate log files of 20MB a day, and it was just cleaner to use
RollingFileAppender as it would generate a new file everyday. Do you what
kind of errors have caused by the RollingFileAppender? If things have been
fixed for next release then maybe switching to log4net 1.2.9 maybe better.
Fahad
-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com]
Sent: 12 December 2005 22:28
To: Log4NET User
Subject: RE: RollingFileAppender Stops logging in Web Service
Try creating an additional FileAppender that does everything your
RollingFileAppender does:
<root>
<level value="INFO" />
<appender-ref ref="OpalLoggingAppender" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="FileAppender" />
</root>
There may be a problem with how the RollingFileAppender is rolling its
files.
Adding a system.diagnostics node to your web.config will allow you to
capture log4net's debug information:
<appSettings>
...
</appSettings>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\Inetpub\\wwwroot\\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
What version of log4net are you using? DOMConfigurator has been depreciated
as of 1.2.9 beta.
--- Fahad Sarwar <fs...@opaltelecom.co.uk> wrote:
> 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 <fs...@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
> >
> >
> >
>
>
RE: RollingFileAppender Stops logging in Web Service
Posted by Ron Grabowski <ro...@yahoo.com>.
Try creating an additional FileAppender that does everything your
RollingFileAppender does:
<root>
<level value="INFO" />
<appender-ref ref="OpalLoggingAppender" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="FileAppender" />
</root>
There may be a problem with how the RollingFileAppender is rolling its
files.
Adding a system.diagnostics node to your web.config will allow you to
capture log4net's debug information:
<appSettings>
...
</appSettings>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\Inetpub\\wwwroot\\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
What version of log4net are you using? DOMConfigurator has been
depreciated as of 1.2.9 beta.
--- Fahad Sarwar <fs...@opaltelecom.co.uk> wrote:
> 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 <fs...@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
> >
> >
> >
>
>
RE: RollingFileAppender Stops logging in Web Service
Posted by Fahad Sarwar <fs...@opaltelecom.co.uk>.
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 <fs...@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
>
>
>
Re: RollingFileAppender Stops logging in Web Service
Posted by Ron Grabowski <ro...@yahoo.com>.
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 <fs...@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
>
>
>
Extending Log4Net
Posted by Fahad Sarwar <fs...@opaltelecom.co.uk>.
Hi,
I have just started to use the latest version of log4net 1.2.9 and would
like to know how best to extend its capabilites to do what i need. We
currently have our own logging application which takes an object called
LogEntry (containing 5 parameters including a Message field) and makes use
of MSMQ and WebService technology.
It is easy enough to write an Appender which extends AppenderSkeleton and
overrides the Append method to make a call to the WebService. But the
difficulty is getting the LogEntry object to the Appender to send to the
WebService. What would be the best way to do this? I guess itll involve
the DefaultRenderer class in someway but not sure how to use this or how to
extend it to pass on the LogEntry object.
Within our code we use the patternlayout as its the most flexible and
provides the most information. I would like to extend this class to log
each item within the LogEntry object as a seperate attribute, i.e.
LogEntry.Category can use %cat, LogEntry.Application %app etc. However i
would like the LogEntry.Message property to use the %m / %message tag and
dont want every property within object to outputted to an appender when %m /
%message is used. Any ideas how this can be achieved?
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