diff --git a/src/Microsoft.Kusto.ServiceLayer/Program.cs b/src/Microsoft.Kusto.ServiceLayer/Program.cs index a8cb8fda..bce3c03b 100644 --- a/src/Microsoft.Kusto.ServiceLayer/Program.cs +++ b/src/Microsoft.Kusto.ServiceLayer/Program.cs @@ -40,9 +40,7 @@ namespace Microsoft.Kusto.ServiceLayer logFilePath = Logger.GenerateLogFilePath("kustoservice"); } - Logger.AutoFlush = commandOptions.AutoFlushLog; - - Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "kustoservice"); + Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "kustoservice", commandOptions.AutoFlushLog); // set up the host details and profile paths var hostDetails = new HostDetails(version: new Version(1, 0)); diff --git a/src/Microsoft.SqlTools.Credentials/Program.cs b/src/Microsoft.SqlTools.Credentials/Program.cs index c3963b7a..8d2e00c2 100644 --- a/src/Microsoft.SqlTools.Credentials/Program.cs +++ b/src/Microsoft.SqlTools.Credentials/Program.cs @@ -38,9 +38,7 @@ namespace Microsoft.SqlTools.Credentials logFilePath = Logger.GenerateLogFilePath("credentials"); } - Logger.AutoFlush = commandOptions.AutoFlushLog; - - Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "credentials"); + Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "credentials", commandOptions.AutoFlushLog); // set up the host details and profile paths var hostDetails = new HostDetails( diff --git a/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs b/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs index 263d97aa..9a4cd9a8 100644 --- a/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs +++ b/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs @@ -110,6 +110,9 @@ namespace Microsoft.SqlTools.Utility /// /// Optional. Specifies the tracesource name. /// + /// + /// Optional. Specifies whether the log is flushed after every message + /// public static void Initialize( SourceLevels tracingLevel = defaultTracingLevel, string logFilePath = null, @@ -140,13 +143,17 @@ namespace Microsoft.SqlTools.Utility /// /// Optional. Specifies the tracesource name. /// - public static void Initialize(string tracingLevel, string logFilePath = null, string traceSource = defaultTraceSource) + /// + /// Optional. Specifies whether the log is flushed after every message + /// + public static void Initialize(string tracingLevel, string logFilePath = null, string traceSource = defaultTraceSource, bool autoFlush = false) { Initialize(Enum.TryParse(tracingLevel, out SourceLevels sourceTracingLevel) ? sourceTracingLevel : defaultTracingLevel , logFilePath - , traceSource); + , traceSource + , autoFlush); } /// diff --git a/src/Microsoft.SqlTools.ResourceProvider/Program.cs b/src/Microsoft.SqlTools.ResourceProvider/Program.cs index 3be39c14..5fd39d2e 100644 --- a/src/Microsoft.SqlTools.ResourceProvider/Program.cs +++ b/src/Microsoft.SqlTools.ResourceProvider/Program.cs @@ -38,9 +38,8 @@ namespace Microsoft.SqlTools.ResourceProvider logFilePath = Logger.GenerateLogFilePath("SqlToolsResourceProviderService"); } - // turn on Verbose logging during early development // we need to switch to Information when preparing for public preview - Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "resourceprovider"); + Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "resourceprovider", commandOptions.AutoFlushLog); Logger.Write(TraceEventType.Information, "Starting SqlTools Resource Provider"); // set up the host details and profile paths diff --git a/src/Microsoft.SqlTools.ServiceLayer/Program.cs b/src/Microsoft.SqlTools.ServiceLayer/Program.cs index 4b481e1a..ba9ec101 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Program.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Program.cs @@ -38,9 +38,7 @@ namespace Microsoft.SqlTools.ServiceLayer logFilePath = Logger.GenerateLogFilePath("sqltools"); } - Logger.AutoFlush = commandOptions.AutoFlushLog; - - Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "sqltools"); + Logger.Initialize(tracingLevel: commandOptions.TracingLevel, logFilePath: logFilePath, traceSource: "sqltools", commandOptions.AutoFlushLog); // set up the host details and profile paths var hostDetails = new HostDetails(version: new Version(1, 0));