If I have my class
public class File
{
public bool Load(string fileName)
bool returnValue = false;
if (File.Exists(fileName))
{
returnValue = true;
Logger.Info("File found.");
}
else
{
Logger.Error("File does not exists.");
}
return returnValue;
}
I tried in my main Program.cs
class Program
{
static void Main(string[] args)
{
var appender = new log4net.Appender.MemoryAppender();
log4net.Config.BasicConfigurator.Configure(appender);
var logEntries = appender.GetEvents();
File file = new File();
string folderPath = @"C:\User\files\";
string[] files = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories);
foreach(string oneFile in files)
{
file.Load(oneFile);
Console.WriteLine(logEntries);
}
Console.ReadLine();
}
}
My program does not write any log in the console, any one can explain why ? Maybe I am all wrong. I just don't get it.