log4net does not log for a class library that is created using .net 4.0
I am creating an add on(Class library (.dll)) for internet explorer 9.0.
And want to use log4net dll for logging.
I am using the following
.NET 4.0
Visual Studio 2010
log4net Version - 1.2.11.0 (for .Net 4.0)
I have created an app.config file and here is the cofiguration that I am
using,
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net,
Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender">
<param name="File" value="D:\\Temp\\Temp.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<param name="MaximumFileSize" value="10MB"/>
<param name="RollingStyle" value="Date" />
<param name="StaticLogFileName" value="true"/>
<param name="DatePattern" value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n"/>
<param name="Footer" value="[Footer]\r\n"/>
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x]
- (%F:%L)
%m%n"/>
</layout>
</appender>
<root>
<level value="ALL"/>
<appender-ref ref="RollingLogFileAppender"/>
</root>
</log4net>
</configuration>
Added the following code line to AssemblyInfo.cs file
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
Added the following code line to DocumentComplete event handler. which
fires upon internet explorer page load.
log4net.Config.XmlConfigurator.Configure();
when my add on is enabled and running . I could not see any log getting
created at the specified path "D:\Temp\Temp.log". I am bit confused.
Any help will be greatly appreciated.
Thanks
No comments:
Post a Comment