I am struggling to get anything to log out using log4net. I have tried using code from various sources but still no joy. Can someone please help me figure out why?
Assembly.cs
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
MyClass.cs
private static readonly ILog log = LogManager.GetLogger(typeof(MyClass));
log.Info("Complete: "+result); // used when my "task" completes, is always called
log4net.config
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="log-file.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<header value="[Your Header text here]" />
<footer value="[Your Footer text here]" />
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
</layout>
</appender>
<!-- Set the default logging level and add the active appenders -->
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
One thing to note is that all this is withing one project. The program running this is in a different project but all logging is done within this assembly.