Support to configure logging levels for sqltools services (#2731)

* Adding support for configuring SqlTools log levels from user configuration. This also adds changes to see the tail of the sqltoolsservicelayer log file in the newly created 'Output->Log (SqlTools)' channel

* Three new user settings control how logging happens. tracingLevel, logRetentionMinutes & logFilesRemovalLimit. Default tracingLevel is set to 'Critical'. 

* The logfiles include ui Extension host process id in their log file names. This ensures that filenames from multiple instances of Azure Data Studio running do not collide with each other. Furthermore log directory for  being used for the tools service backend processes. This ensures that there is no name conflict when multiple instances of azuredatastudio are running on the same box. Also when azuredatastudio is started from vscode under debugger the log directory is set to %APPDATA%\Code\mssql while the official location is %APPDATA%\azuredatastudio\mssql. So dev environment should not affect other running instances. Kindly note that all debug runs of azuredatastudio share the same directory and all non debug runs share a directory different from those running under debugger. 

* Log files older than a week get cleaned up upon start-up. The log file cleanup behavior can be controlled at user level by  logRetentionMinutes & logFilesRemovalLimit settings.
This commit is contained in:
ranasaria
2018-10-10 11:24:13 -07:00
committed by GitHub
parent c3a81b5bf3
commit 5a62035ed7
15 changed files with 156 additions and 40 deletions

View File

@@ -101,6 +101,11 @@ export class ExtensionHostProcessWorker {
}));
}
// {{SQL CARBON EDIT}}
public getExtenstionHostProcess(): ChildProcess {
return this._extensionHostProcess;
}
public dispose(): void {
this.terminate();
}

View File

@@ -152,6 +152,11 @@ export class ExtensionHostProcessManager extends Disposable {
});
}
// {{SQL CARBON EDIT}}
public getExtenstionHostProcessWorker(): ExtensionHostProcessWorker {
return this._extensionHostProcessWorker;
}
public dispose(): void {
if (this._extensionHostProcessWorker) {
this._extensionHostProcessWorker.dispose();
@@ -296,6 +301,14 @@ export class ExtensionService extends Disposable implements IExtensionService {
}
}
// {{SQL CARBON EDIT}}
public getExtenstionHostProcessId(): number {
if (this._extensionHostProcessManagers.length !== 1)
{
this._logOrShowMessage(Severity.Warning, 'Exactly one Extension Host Process Manager was expected');
}
return this._extensionHostProcessManagers[0].getExtenstionHostProcessWorker().getExtenstionHostProcess().pid;
}
private startDelayed(lifecycleService: ILifecycleService): void {
let started = false;
const startOnce = () => {