Skip to content

Commit 86f32d8

Browse files
kyliauKeen Yee Liau
authored andcommitted
fix: turn off logging by default
For large projects (especially projects in google3), logging to file with will slow down the language service because it prints all the filenames in the project. This is true even when the logging verbosity is `terse` (the old default). This PR turns off logging by default. If users want to inspect the logs, they can run the `Open Angular server log` command, which will automatically set the log verbosity to `verbose` and restart the server.
1 parent 8680168 commit 86f32d8

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

client/src/commands.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ function openLogFile(client: AngularLanguageClient): Command {
6060
const isGlobalConfig = false;
6161
await vscode.workspace.getConfiguration().update(
6262
'angular.log', 'verbose', isGlobalConfig);
63-
// Restart the server
64-
await client.stop();
65-
await client.start();
63+
// Server will automatically restart because the config is changed
6664
}
6765
return;
6866
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"normal",
6464
"verbose"
6565
],
66-
"default": "terse",
66+
"default": "off",
6767
"description": "Enables logging of the Angular server to a file. This log can be used to diagnose Angular Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project."
6868
},
6969
"angular.experimental-ivy": {

server/src/server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ const session = new Session({
4848
session.info(`Angular language server process ID: ${process.pid}`);
4949
session.info(`Using ${ts.name} v${ts.version} from ${ts.resolvedPath}`);
5050
session.info(`Using ${ng.name} v${ng.version} from ${ng.resolvedPath}`);
51-
session.info(`Log file: ${logger.getLogFileName()}`);
51+
if (logger.loggingEnabled()) {
52+
session.info(`Log file: ${logger.getLogFileName()}`);
53+
} else {
54+
session.info(`Logging is turned off. To enable, run command 'Open Angular server log'.`);
55+
}
5256
if (process.env.NG_DEBUG === 'true') {
5357
session.info('Angular Language Service is running under DEBUG mode');
5458
}

0 commit comments

Comments
 (0)