private static bool DeleteOldArchiveFile(string fileName)
{
try
{
InternalLogger.Info("Deleting old archive file: '{0}'.", fileName);
File.Delete(fileName);
return true;
}
catch (DirectoryNotFoundException exception)
{
//never rethrow this, as this isn't an exceptional case.
InternalLogger.Debug(exception, "Failed to delete old log file '{0}' as directory is missing.", fileName);
return false;
}
catch (Exception exception)
{
InternalLogger.Warn(exception, "Failed to delete old archive file: '{0}'.", fileName);
if (exception.MustBeRethrown())
{
throw;
}
return false;
}
}