I'm using log4net
in order to create a log, but it doesn't do anything.
Here is the app.config
:
<?xml version="1.0" encoding="utf-8">
<configuration>
<configSection>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSection>
<log4net>
<appender name="WriteToFile" type="log4net.Appender.FileAppender">
<file value="log.txt" />
<layout ="log4net.Layout.SimpleLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="WriteToFile"/>
</root>
</log4net>
</configuration>
I have the following line in AssemblyInfo.cs
:
[assembly: log4net.Config.XmlConfigur(ConfigFile ="App.config", Watch= true)]
Here is an attempt to write to the file:
private static readonly ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public void write()
{
log.Info("Some text here");
}
And the following line:
log4net.Config.XmlConfigurator.Configure();