This document explains how to record a session communications log from a running Dart Analysis Server (DAS) process.
A session communications log records all communications (requests, responses, and notifications) between a client (such as VS Code or IntelliJ / Android Studio) and DAS.
These logs are particularly helpful when:
There are two ways to record a session communications log:
--session-log command-line option (captures all communications from the moment the server launches).The Analyzer Insights website served by DAS includes a Session communications log page. Even before you click “Start capturing”, the server maintains a small in-memory cache of critical startup messages (initialization requests, workspace configurations, and opened documents). When you start capturing, subsequent editor interactions are added to the buffer, ensuring the resulting log contains the context needed to reproduce the session.
session_log.json), or attach it to your issue report.--session-log command-line optionIf you need to record every communication from server startup (or cannot use the web UI), you can pass the --session-log flag to DAS. The server will stream log entries line-by-line to the specified file on disk.
Open your VS Code settings (Preferences: Open User Settings (JSON) or Preferences: Open Workspace Settings (JSON)).
Add the --session-log option to dart.analyzerAdditionalArgs:
"dart.analyzerAdditionalArgs": [ "--session-log=/path/to/session_log.json" ]
Restart the analysis server by opening the command palette and running Dart: Restart Analysis Server.
Perform the actions you want to capture.
When done, remove the argument from your settings and restart the server again so the log file stops growing.
dart.server.additional.arguments.--session-log=/path/to/session_log.json to the property's value (separated from any other arguments by a space).When running the analysis server or language server directly from the command line:
dart language-server --protocol=lsp --session-log=/path/to/session_log.json
The recorded file contains line-delimited JSON (JSON Lines format, often saved as .json or .txt). Each line is an independent, self-contained JSON object representing a single event:
time: Milliseconds since epoch when the event occurred.kind: The type of event (e.g., commandLine or message).sender: The source process (e.g., ide, server, watcher, or dtd).receiver: The destination process.message: The JSON-RPC payload sent between the processes.You can evaluate the duration of any request/response interaction directly from the log:
"sender": "ide" and "receiver": "server"). Note its "id" and its timestamp ("time" or "clientRequestTime" within "message")."id" (where "sender": "server" and "receiver": "ide").response.time - request.time (or response.time - request.message.clientRequestTime).[!NOTE] Cold start vs. warm server: When an IDE first opens a workspace, the server initializes and analyzes files in the background (tracked via
$/progressnotifications). Requests sent before initial analysis finishes will wait in the server's queue, so their response time includes initial workspace analysis. Subsequent requests executed once the server is idle reflect actual handler computation time.
Recorded session logs contain file paths on your machine (e.g. /Users/$USER/...) as well as file contents for documents opened or edited during the session.
If you are sharing a log file publicly (such as on the Dart SDK issue tracker):
Review the log file to ensure it does not include sensitive or proprietary source code.
You can normalize machine-specific paths into generic placeholders ({{workspaceFolder-0}}, {{dartSdkRoot}}, etc.) using normalize.dart:
dart pkg/analysis_server/tool/log_player/normalize.dart \ -i /path/to/session_log.json \ -o /path/to/normalized_log.json \ -r /path/to/workspace/root
Once you have recorded a log file:
pkg/analysis_server/tool/log_player.