In the main class declare
using log4net.Config;
using System.IO;
using log4net.Core;
using log4net.Repository;
// Registers Logger for logging
private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(PCSCoreSimulator));
private void StartLog()
{
string fullPath = Application.ExecutablePath + ".config";
XmlConfigurator.ConfigureAndWatch(new FileInfo(filePath));
}
private void TestLog()
{
logger.Error("Error");
logger.Info("Infor");
...
}