microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
732 stars 243 forks source link

EditorServices.log grows with not configured verbose entries to GB #6828

Open Grueslayer opened 2 years ago

Grueslayer commented 2 years ago

The file %localappdata%/EditorServices.log grows up to multiple GB in a few weeks.

This can be reproduced by following steps:

  1. Open VSCode with an AL workspace of your choice
  2. Open a new VSCode window <Ctrl> <Shift> N and load another AL workspace with at least one AL file opened as tab.

Now the EditorServices.log contains a lot of verbose output (including source from your AL files). Here some lines:

11/10/2021 15:32:37 [/1] Editor Services Host v8.1.8.16322 starting (pid 29384)...
11/10/2021 15:32:37 [/1] Editor Services Host started!
11/10/2021 15:32:37 [/6] Process:

 initialize
11/10/2021 15:32:37 [/6] Processing initialize took 0 seconds
11/10/2021 15:32:38 [/8] Process:

 workspace/didChangeConfiguration
11/10/2021 15:32:39 [/8] Processing workspace/didChangeConfiguration took 0 seconds
11/10/2021 15:32:39 [/8] Process:

 textDocument/didOpen
11/10/2021 15:32:39 [/8] Processing textDocument/didOpen took 0 seconds
11/10/2021 15:32:39 [/8] Process:

 al/setActiveWorkspace
11/10/2021 15:32:39 [/8] Processing al/setActiveWorkspace took 0 seconds
11/10/2021 15:32:39 [1/14] Parsing Codeunit 50012 "CCO0 SRV Mgt.".
11/10/2021 15:32:39 [1/14] Parsing Codeunit 50012 "CCO0 SRV Mgt.".
11/10/2021 15:32:40 [/9] Parsing TableExtension 50087 "CCO0 Warehouse Receipt Line".
11/10/2021 15:32:40 [/9] Parsing Codeunit 50001 "CCO0 Availability Management".
11/10/2021 15:32:40 [/9] Parsing Codeunit 50016 "CCO0 Barcode Mgt.".

...

 textDocument/documentSymbol
11/10/2021 15:32:50 [2/18] Binding property 'Extensible = true;' declared on 'Enum "CCO0 Overdelivery"'.
11/10/2021 15:32:50 [3/4] Binding property 'Extensible = true;' declared on 'Enum "CCO0 On Hold Status"'.
11/10/2021 15:32:50 [4/23] Binding property 'Extensible = true;' declared on 'Enum "CCO0 Mobile Status"'.
11/10/2021 15:32:50 [5/10] Binding the members for Codeunit "CCO0 Availability Management".
11/10/2021 15:32:50 [6/25] Binding the members for TableExtension "CCO0 Sales Line".

...

11/10/2021 15:32:51 [59/14] Binding property 'DataClassification = ToBeClassified;' declared on '"Source Code"'.
11/10/2021 15:32:51 [59/14] Binding property 'TableRelation = IF ("Source Type" = CONST(Contact)) Contact."No."
            ELSE
            IF ("Source Type" = CONST(Customer)) Customer."No."
            ELSE
            IF ("Source Type" = CONST(Vendor)) Vendor."No."
            ELSE
            IF ("Source Type" = CONST(Bank)) "Bank Account"."No.";' declared on '"Source Code"'.
11/10/2021 15:32:51 [64/26] Binding property 'ApplicationArea = All;' declared on 'Field "CCO0 Indoor Sales User": Code[20]'.

and so on.

The Editor Services Log Level ist set to Normal and if you keep working in one instance of VSCode the log file is not available at all.

-- System Information -- AL Language VSCode Extension 8.1.540594 Microsoft (R) AL Compiler version 8.1.8.16322 VSCode 1.62.1

kalberes commented 2 years ago

These kind of detailed settings should only be logged if Verbose. Are you sure you do not have a workspace or folder based settings that overrides it.

Grueslayer commented 2 years ago

Sorry....

I must revise my last comment. You are correct (a tool of ours has updated the workspace settings).

Now the situation is:

  1. No entry in global settings
  2. Verbose in workspace for project A
  3. Verbose in workspace for project B

and the result is this:

  1. If you open Project A in a single window --> No output
  2. If you open Project B in a single window --> No output
  3. If you open Project A and then B in a second window --> Output from B
  4. If you open Project B and then A in a second window --> Output from A

So it seems the first instance does not handle the workspace settings correct.... or am I wrong?

kalberes commented 2 years ago

You mean a second instance of VSCode as the term "second window"? Or these are folder settings rather than workspace?

Grueslayer commented 2 years ago

Global settings C:\Users\jstocker9330\AppData\Roaming\Code\User\settings.json

NO settings for log existing

{
    "todo-tree.tree.showScanModeButton": false,
    "workbench.iconTheme": "al",
    "php.validate.executablePath": "",
    "vsicons.dontShowNewVersionMessage": true,
    "git.suggestSmartCommit": false,
    "git.confirmSync": false,
    "git.defaultCloneDirectory": "c:/dev/devops",
    "alObjectDesigner.useInternalNavigation": false,
    "editor.formatOnSave": true,
    "al.backgroundCodeAnalysis": true,
    "al.enableCodeAnalysis": true,
    "terminal.integrated.tabs.enabled": true,
    "security.workspace.trust.enabled": false,
    "security.workspace.trust.untrustedFiles": "open",
    "explorer.confirmDelete": false,
    "editor.largeFileOptimizations": false
}

Project A C:\Dev\devops\DEHAM-BUE\CCO0 Main\CCO0 Main.code-workspace contains al.editorServicesLogLevel = Verbose

{
  "folders": [
    {
      "name": "app",
      "path": "app"
    },
    {
      "name": "test",
      "path": "test"
    }
  ],
  "settings": {
    "al.assemblyProbingPaths": [
      "./.netpackages",
      "C:/Windows/assembly/",
      "C:/Program Files/Microsoft Dynamics 365 Business Central/160/Service/Add-ins"
    ],
    "al.codeAnalyzers": [
      "${PerTenantExtensionCop}",
      "${CodeCop}",
      "${UICop}"
    ],
    "al.editorServicesLogLevel": "Verbose",
    "al.enableCodeActions": true,
    "al.enableCodeAnalysis": true,
    "al.ruleSetPath": "./.codeAnalysis/thisproject.ruleset.json",
    "alObjectDesigner.useInternalNavigation": false
  }
}

If you now start VSCode (no other instance of VSCode is running) and Open Workspace from File... choose that workspace then

NO EditorServices.log file is created and if that exist, NO output is written.

If the workspace configuration (you can see above) is applied, it should write verbose output but doesn't.

Now press <Ctrl><Shift>N a new VSCode instance (window) will be opened. Start Open Workspace fro File... and choose another Workspace file, lets name it Project B from C:\Dev\devops\DE-NORD-RDA\CCO0_Main\CCO0_Main.code-workspace.

This is another window / instance of VSCode with another workspace in another folder.

Now this newly opened workspace creates verbose messages in the log.

If you do this vice versa (opening B first and in another new instance A) then A is logging verbose.

I don't know how to explain this in more detail....

kalberes commented 2 years ago

Ok, thanks. We will investigate it. The AL language server is an exe (EditorHost.exe) opened by VsCode. The log verbosity option is provided as a command line argument to this instance as opposed to other AL options. So this option is global for the lifetime of the exe. And there is only one EditorServices.log that can be used by one language server executable instance as it is designed today.