1
Vote

Logging LogFile filepath cannot contain directory and rollover

description

When a LogFile is created with the filepath containing more than a filename, the rollover check fails.
For example, creating this LogFile:

Logger.Default.Append(new LogFile("kishores_log", "C:\kishore.txt",DateTime.UtcNow, null,true,1));

Once the log file grows large enough, the FlushCheck() method tries to create a new log.

This line throws an error because the searchPath contains more than just the file name:
string[] files = Directory.GetFiles(file.DirectoryName, searchPath + "*", SearchOption.TopDirectoryOnly);

comments