I'm trying to integrate log4net dll in one of the project. it works fine when i run it locally.However, when i try to deploy the project as COM Object remotely, it doesn't create any log file at given location. FYI, i'm using .net framework 2 for this project
I have made all the changes mentioned on the following link but still no luck
AssesmblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "app.config", Watch = true)]
app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
</configSections>
<log4net>
<appender name="TestAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="D:\\log\\SchT%date{yyyyMMdd}.log" />
<encoding value="utf-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<!--<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="5MB" />
<staticLogFileName value="true" />-->
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level [%thread] %type.%method - %message%n"/>
</layout>
</appender>
<root>
<level value="All"/>
<!-- If the following line is not included the log file will not be created even if log4net is configured with this file. -->
<appender-ref ref="TestAppender"/>
</root>
</log4net>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Controller
log4net.Config.XmlConfigurator.Configure();
_log = log4net.LogManager.GetLogger
(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
When i debug it, _log gets all log levels as false. I suspect, app.config doesn't load properly that's why file is not created.
Any idea?