A message that cannot be written, for example because the folder of the log file cannot be created or the file is locked by another process, is lost: an error of logging never stops the operation that is logged. When the file reaches its maximum size, its oldest messages are deleted, and the newest messages that take half of the maximum size are kept. A file that cannot be shortened at that moment, for example because another process has it open for writing, is shortened later; the message is written anyway. Several loggers of a process can write the same file.
The example demonstrates a typical usage of the class.
stringindexFolder=@"c:\MyIndex\";stringdocumentsFolder=@"c:\MyDocuments\";stringquery="Einstein";stringlogPath=@"c:\Log.txt";IndexSettingssettings=newIndexSettings();settings.Logger=newFileLogger(logPath,4.0);// Specifying the path to the log file and a maximum length of 4 MBIndexindex=newIndex(indexFolder,settings);// Creating an index in the specified folderindex.Add(documentsFolder);// Indexing documents from the specified folderSearchResultresult=index.Search(query);// Search in index