Add command line option to specify the logging directory (#336)

Two changes in this PR:
* Add a --log-dir command line parameter and fix command line parsing
* Fix command line parsing where arguments with parameter were parsed incorrectly
This commit is contained in:
Brian O'Neill
2017-05-10 08:55:46 -07:00
committed by GitHub
parent 2e9843cec1
commit 7625c8d83d
6 changed files with 124 additions and 55 deletions

View File

@@ -73,6 +73,24 @@ namespace Microsoft.SqlTools.Utility
Logger.isInitialized = true;
// Create the log directory
string logDir = Path.GetDirectoryName(logFilePath);
if (!string.IsNullOrWhiteSpace(logDir))
{
if (!Directory.Exists(logDir))
{
try
{
Directory.CreateDirectory(logDir);
}
catch (Exception)
{
// Creating the log directory is a best effort operation, so ignore any failures.
}
}
}
// get a unique number to prevent conflicts of two process launching at the same time
int uniqueId;
try