Interim solution for logfile being deleted.
This commit is contained in:
@@ -94,6 +94,27 @@ namespace MarketData.Utils
|
||||
catch(Exception){;}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveLogFilesExcept(String exceptFile,String strFolder=null)
|
||||
{
|
||||
if(null==strFolder)strFolder=Directory.GetCurrentDirectory();
|
||||
String[] logFiles=Directory.GetFiles(strFolder,"*.log");
|
||||
if(null==logFiles || 0==logFiles.Length)return;
|
||||
logFiles=logFiles
|
||||
.Where(x => x.EndsWith(".log",StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!x.EndsWith(exceptFile,StringComparison.InvariantCultureIgnoreCase)).ToArray<String>();
|
||||
if(null==logFiles || 0==logFiles.Length)return;
|
||||
foreach(String logFile in logFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Removing {0}",logFile));
|
||||
File.Delete(logFile);
|
||||
}
|
||||
catch(Exception){;}
|
||||
}
|
||||
}
|
||||
|
||||
public static String Pad(string str, char filler, int length)
|
||||
{
|
||||
int stringLength = str.Length;
|
||||
|
||||
Reference in New Issue
Block a user