Skip to content

Diagnostic Logging

Steve Dower edited this page Mar 22, 2018 · 6 revisions

There are a number of places where specialized logging can be enabled. This is primarily for debugging purposes, and enabling these logs will have a performance impact.

Diagnostic analysis log

This logs the contents of the analysis queue as items are enqueued and processed. The output is CSV and may produce hundreds of megabytes per second.

To enable, set HKCU\Software\Microsoft\PythonTools\15.0\Analysis\StandardLibrary@LogPath to the path to write the log to, or if directly invoking Microsoft.PythonTools.Analyzer.exe pass the /diag option.

Connection logs

These log JSON-RPC messages sent between the IDE and other processes. To enable, create a DWORD values 1 in HKCU\Software\Microsoft\PythonTools\ConnectionLog for one of the below items. The logs will be created in %TEMP%.

  • Analyzer - messages from the out-of-proc analyzer to the IDE
  • ProjectAnalyzer - messages from the IDE to the out-of-proc analyzer
  • TestExecutor - messages from the test executor to the testee
  • DebugConnection - messages from the IDE to the debuggee

Other logs

These log various messages from within the IDE or a child process. To enable, create a DWORD value 1 in HKCU\Software\Microsoft\PythonTools\Logging

  • AnalyzerTrace - increases the level of trace messages sent from the analyzer (these appear in the Analyzer connection log)
  • BufferInfo - messages from the text buffer to a text file in %TEMP%

AST Analysis log

This logs AST analysis (new-style analysis) info. By default, verbose messages are logged in debug builds and info messages are logged in release builds.

TODO: There is currently no way to adjust this without rebuilding.

Logs are written to AnalysisLog.txt in the environment's database directory. They can be viewed by collecting diagnostic info.

System Events

Some unhandled exceptions are written to the system event log. These can be viewed by collecting diagnostic info.

In debug builds, all unhandled or unobserved exceptions trigger assertions. In test runs, all NullReferenceException and ObjectDisposedException are logged to the event log as warnings.

Clone this wiki locally