i have two projects in visual studio. One is the console project while other is regular c# project. In the regular c# project, i have added config file(i.e. Test.config) with log4net section. This file is embedded.
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="fileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log//testapp.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d{ISO8601} [%t] [%-5p] %c - %m%n" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default priority -->
<root>
<priority value="ALL" />
<appender-ref ref="fileAppender" />
</root>
</log4net>
</Configuration>
Now in my console project, i want to tell my log4net to load log4net information from (Test.config) which is in another project.
This is what i did in the constructor of console project:
Assembly asm = Assembly.GetExecutingAssembly();
Stream xmlStream = asm.GetManifestResourceStream("Northwind.Participant.Config.Test.config");
ILog log = LogManager.GetLogger(typeof(ConsoleStart));
'Northwind.Participant is full namespace. Config - folder where Test.config file is situated.
Now i am having problem logging any log message. Does anyone know how i can do that?